From f7c7c064b50f2be7d5c53f18e2bd329a09fd4782 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 13 Jan 2024 10:20:02 +0100 Subject: [PATCH 1/6] ci: Only push the docker container on push Don't try to push the docker container on a PR as that will fail for PRs that aren't from project members --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a25e8d3..ff84099 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 + if: github.event_name != 'pull_request' with: context: . push: true From c8999474ac15cfa2c56a5e75c994682687abbbd2 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 13 Jan 2024 11:11:30 +0100 Subject: [PATCH 2/6] ci: switch away from actions-rs actions-rs is no longer maintained, switch over to dtolnay/rust-toolchain instead which is. While there also ensure the various checks also check all targets/features as applicable For the rust toolchain aim for a specific version so CI doesn't start failing over time. For the version also aim for the version of rustc in debian unstable to ensure things can build with that version of the compiler --- .github/workflows/ci.yml | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff84099..4ad3af4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,51 +12,36 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: actions-rs/cargo@v1 - with: - command: check - args: --all-features + - uses: dtolnay/rust-toolchain@1.70 + - run: cargo check --all-targets --all-features fmt: name: cargo fmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: actions-rs/cargo@v1 + - uses: dtolnay/rust-toolchain@1.70 with: - command: fmt - args: --all --check + components: rustfmt + - run: cargo fmt --all --check test: name: cargo test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: actions-rs/cargo@v1 - with: - command: test + - uses: dtolnay/rust-toolchain@1.70 + - run: cargo test --all-targets --all-features clippy: name: cargo clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: actions-rs/cargo@v1 + - uses: dtolnay/rust-toolchain@1.70 with: - command: clippy - args: -- -D warnings + components: clippy + - run: cargo clippy --all-targets --all-features -- -D warnings docker-image: name: Docker image build From 3a128ae79f741ba0bcb60eb4cb5d718dae0819f3 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 13 Jan 2024 11:18:52 +0100 Subject: [PATCH 3/6] ci: Run clippy from the latest rust toolchain To allow catching newer clippy lints also run clippy from the latest stable rust toolchain. This check is allowed to fail so CI doesn't start failing due to newer lints being introduced. --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ad3af4..1334665 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,17 @@ jobs: components: clippy - run: cargo clippy --all-targets --all-features -- -D warnings + clippy-latest: + name: cargo clippy latest + runs-on: ubuntu-latest + continue-on-error: true + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - run: cargo clippy --all-targets --all-features -- -D warnings + docker-image: name: Docker image build runs-on: ubuntu-latest From 55dca26b8e15c46cade20dfc506358e6c2e4621b Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 13 Jan 2024 11:22:30 +0100 Subject: [PATCH 4/6] ci: Run a minimal dependencies check Check the build still works when actually using the (direct) minimal dependencies. For now this needs a nightly rust --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1334665..0ceb0c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,16 @@ jobs: components: clippy - run: cargo clippy --all-targets --all-features -- -D warnings + minimal-dependencies: + name: minimal direct dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@nightly + with: + components: clippy + - run: cargo check -Z direct-minimal-versions + docker-image: name: Docker image build runs-on: ubuntu-latest @@ -96,6 +106,7 @@ jobs: - test - clippy - docker-image + - minimal-dependencies runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed From 790fc9c78932059a79f1990b37929db9f181c5e1 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 13 Jan 2024 11:40:30 +0100 Subject: [PATCH 5/6] ci: adjust triggers for gh merge queues For merge queue's to work the CI has to run on the `merge_group` event. Also ignore pushes to the merge queue branches to avoid running CI twice --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ceb0c6..f78d3a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ -on: [push, pull_request] - name: CI +on: + push: + branches-ignore: + - "gh-readonly-queue/**" + pull_request: + merge_group: env: REGISTRY: ghcr.io From bdd8f5b82937f4f197c5a74574915fedb4eeb138 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 13 Jan 2024 23:23:35 +0100 Subject: [PATCH 6/6] Cargo.toml: Fix direct-minimal-versions and do crate updates Update the required crate versions as needed to ensure the build succeeds with direct minimal versions as well as some smaller updates for new crate versions --- Cargo.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6fd01b5..e668fd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,23 +9,23 @@ homepage = "https://gitlab.collabora.com/lava/lava-gitlab-runner" repository = "https://gitlab.collabora.com/lava/lava-gitlab-runner.git" [dependencies] -bytes = "1.2.0" -chrono = { version = "0.4", features = ["serde"] } +bytes = "1.2.1" +chrono = { version = "0.4.20", features = ["serde"] } colored = "2" gitlab-runner = "0.0.8" -lava-api = "0.1.1" +lava-api = "0.1.2" lazy_static = "1.4" structopt = "0.3.23" url = "2.2.2" -tokio = "1.12.0" +tokio = "1.35" async-trait = "0.1.51" futures = "0.3.17" -handlebars = "4" +handlebars = "5" masker = { version="0.0.4", features=["streams"] } -junit-parser = "0.2" -serde = { version = "^1.0.97", features = ["derive"] } +junit-parser = "1" +serde = { version = "^1.0.194", features = ["derive"] } serde_json = "1.0.68" -serde_yaml = "0.9" +serde_yaml = "0.9.30" rand = "0.8.4" tempfile = "3.3.0" tokio-util = { version = "0.7", features = [ "io" ] }