Compare commits

..

8 Commits

Author SHA1 Message Date
3cb83bb79c with bin cache 2023-02-19 11:47:55 +01:00
Renovate Bot
199fe16dbf fix(deps): update rust crate dagger-sdk to 0.2.1 2023-02-18 17:34:50 +01:00
3cfd032a85 add cache 2023-02-18 17:13:41 +01:00
83ae5b476a fix(ci): fix github secret naming 2023-02-18 17:05:40 +01:00
60dfad0aaa run everywhere 2023-02-18 17:04:40 +01:00
25fb9d4f24 fix(ci): with secret 2023-02-18 17:03:37 +01:00
f42da8416a feat(ci): with sccache 2023-02-18 16:57:35 +01:00
98781f2496 test change 2023-02-18 16:06:34 +01:00
5 changed files with 96 additions and 24 deletions

View File

@@ -1,8 +1,13 @@
name: ci name: ci
on: on:
pull_request: pull_request:
push:
branches:
- "main"
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -11,5 +16,16 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Update rust toolchain - name: Update rust toolchain
run: rustup update stable && rustup default stable run: rustup update stable && rustup default stable
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: "~/.cargo/bin/\n~/.cargo/registry/index/\n~/.cargo/registry/cache/\n~/.cargo/git/db/\ntarget/ "
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.0.0
- name: Run dagger [CI] - name: Run dagger [CI]
run: cargo run -p ci -- pr run: cargo run -p ci -- pr

44
Cargo.lock generated
View File

@@ -114,7 +114,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"clap", "clap",
"color-eyre", "color-eyre",
"dagger-sdk 0.2.0", "dagger-sdk 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"eyre", "eyre",
] ]
@@ -259,9 +259,7 @@ dependencies = [
[[package]] [[package]]
name = "dagger-core" name = "dagger-core"
version = "0.2.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02a16b0e83ae5b88a3d4e2f3cf5149932cfcb3113e67f5579372e25d5dab5b53"
dependencies = [ dependencies = [
"clap", "clap",
"dirs", "dirs",
@@ -284,6 +282,8 @@ dependencies = [
[[package]] [[package]]
name = "dagger-core" name = "dagger-core"
version = "0.2.1" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4805375918d0605477dac436be1c4d13a46c6f3fa1383b8eb624a31688a4b99b"
dependencies = [ dependencies = [
"clap", "clap",
"dirs", "dirs",
@@ -328,24 +328,6 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "dagger-sdk"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e454c49b81feeb5c4057f54223cb8d7618e5d015ed835c3f3fa231fefa04e833"
dependencies = [
"base64",
"dagger-core 0.2.0",
"eyre",
"futures",
"genco",
"gql_client",
"pretty_assertions",
"serde",
"serde_json",
"tokio",
]
[[package]] [[package]]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.2.1" version = "0.2.1"
@@ -363,6 +345,24 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "dagger-sdk"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91342638dfdcd44ca5d3a2cc1b962e3f2c0e461487e90fe62972ef31df74c061"
dependencies = [
"base64",
"dagger-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"eyre",
"futures",
"genco",
"gql_client",
"pretty_assertions",
"serde",
"serde_json",
"tokio",
]
[[package]] [[package]]
name = "diff" name = "diff"
version = "0.1.13" version = "0.1.13"

View File

@@ -8,5 +8,5 @@ edition = "2021"
[dependencies] [dependencies]
clap = "4.1.6" clap = "4.1.6"
color-eyre = "0.6.2" color-eyre = "0.6.2"
dagger-sdk = "0.2.0" dagger-sdk = "0.2.1"
eyre = "0.6.8" eyre = "0.6.8"

View File

@@ -97,11 +97,66 @@ fn get_dependencies(client: Arc<Query>) -> Container {
let cache_cargo_index_dir = client.cache_volume("cargo_index".into()); let cache_cargo_index_dir = client.cache_volume("cargo_index".into());
let cache_cargo_deps = client.cache_volume("cargo_deps".into()); let cache_cargo_deps = client.cache_volume("cargo_deps".into());
let cache_cargo_bin = client.cache_volume("cargo_bin_cache".into());
let minio_url = "https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz".into();
let base_image = client let base_image = client
.container(None) .container(None)
.from("rust:latest".into()) .from("rust:latest".into())
.with_workdir("app".into()) .with_workdir("app".into())
.with_exec(vec!["apt-get".into(), "update".into()], None)
.with_exec(
vec![
"apt-get".into(),
"install".into(),
"--yes".into(),
"libpq-dev".into(),
"wget".into(),
],
None,
)
.with_exec(vec!["wget".into(), minio_url], None)
.with_exec(
vec![
"tar".into(),
"xzf".into(),
"sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz".into(),
],
None,
)
.with_exec(
vec![
"mv".into(),
"sccache-v0.3.3-x86_64-unknown-linux-musl/sccache".into(),
"/usr/local/bin/sccache".into(),
],
None,
)
.with_exec(
vec!["chmod".into(), "+x".into(), "/usr/local/bin/sccache".into()],
None,
)
.with_env_variable("RUSTC_WRAPPER".into(), "/usr/local/bin/sccache".into())
.with_env_variable(
"AWS_ACCESS_KEY_ID".into(),
std::env::var("AWS_ACCESS_KEY_ID").unwrap_or("".into()),
)
.with_env_variable(
"AWS_SECRET_ACCESS_KEY".into(),
std::env::var("AWS_SECRET_ACCESS_KEY").unwrap_or("".into()),
)
.with_env_variable("SCCACHE_BUCKET".into(), "sccache".into())
.with_env_variable("SCCACHE_REGION".into(), "auto".into())
.with_env_variable(
"SCCACHE_ENDPOINT".into(),
"https://api-minio.front.kjuulh.io".into(),
)
.with_mounted_cache("~/.cargo/bin".into(), cache_cargo_bin.id(), None)
.with_mounted_cache("~/.cargo/registry/index".into(), cache_cargo_bin.id(), None)
.with_mounted_cache("~/.cargo/registry/cache".into(), cache_cargo_bin.id(), None)
.with_mounted_cache("~/.cargo/git/db".into(), cache_cargo_bin.id(), None)
.with_mounted_cache("target/".into(), cache_cargo_bin.id(), None)
.with_exec( .with_exec(
vec!["cargo".into(), "install".into(), "cargo-chef".into()], vec!["cargo".into(), "install".into(), "cargo-chef".into()],
None, None,

View File

@@ -4,7 +4,8 @@ pub mod cli;
mod cli_generate; mod cli_generate;
fn main() -> eyre::Result<()> { fn main() -> eyre::Result<()> {
// test change //
color_eyre::install().unwrap(); color_eyre::install().unwrap();
let args = std::env::args(); let args = std::env::args();