From 4e80dd009a8b89e3cd61d414ffe0f4dc324aa2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= Date: Fri, 8 May 2026 23:25:01 +0200 Subject: [PATCH] ci: cherry-pick changes from PR #815 That PR got hard to review and confidently merge, so I'm cherry-picking some of the good ideas from it in a format that feels more comfortable to me. Thanks @vlakoff for the original PR! Co-authored-by: vlakoff <544424+vlakoff@users.noreply.github.com> --- .dockerignore | 9 ++++++--- .github/workflows/deploy.yml | 15 ++++++++++----- .github/workflows/docker.yml | 10 ++++++++-- .github/workflows/oxipng.yml | 7 ++++++- .gitignore | 8 ++++---- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/.dockerignore b/.dockerignore index 136b3eca..14ffd940 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,7 @@ -scripts -.github .editorconfig -.pre-commit-hooks.yaml +.gitignore +/.git/ +/.github/ +/.pre-commit-hooks.yaml +/scripts/ +/target/ diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2bc05df5..4c15258f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,12 @@ name: deploy on: push: tags: - - "v*.*.*" + - v*.*.* + +concurrency: + # If we ever end up with two concurrent jobs for releasing the same tag, the former should be cancelled + group: release-${{ github.ref }} + cancel-in-progress: true permissions: actions: read @@ -54,15 +59,15 @@ jobs: - name: Get the Oxipng version id: oxipngMeta - run: - echo "version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "oxipng").version')" - >> "$GITHUB_OUTPUT" + run: > + echo "version=$(cargo metadata --format-version 1 --no-deps | + jq -r '.packages[] | select(.name == "oxipng").version')" >> "$GITHUB_OUTPUT" - name: Retrieve ${{ matrix.target }} binary uses: dawidd6/action-download-artifact@v21 with: workflow: oxipng.yml - commit: ${{ env.GITHUB_SHA }} + commit: ${{ github.sha }} name: Oxipng binary (${{ matrix.target }}) path: target diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 66a3de4c..852c2739 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,9 +2,9 @@ name: docker on: push: branches: - - 'master' + - master tags: - - 'v*.*.*' + - v*.*.* pull_request: types: - opened @@ -17,6 +17,12 @@ on: type: boolean default: true +concurrency: + # If we ever end up with two concurrent Docker build jobs for the same commit + # and same versioning context, the former should be cancelled + group: docker-${{ github.sha }}-${{ github.ref_type }}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build: uses: docker/github-builder/.github/workflows/build.yml@v1 diff --git a/.github/workflows/oxipng.yml b/.github/workflows/oxipng.yml index 7c033914..b3db7348 100644 --- a/.github/workflows/oxipng.yml +++ b/.github/workflows/oxipng.yml @@ -8,6 +8,11 @@ on: - synchronize workflow_dispatch: +concurrency: + # If we ever end up with two concurrent CI jobs for the same commit, the former should be cancelled + group: ci-${{ github.sha }} + cancel-in-progress: true + jobs: ci: name: CI @@ -126,7 +131,7 @@ jobs: - name: Build CLI binary run: cargo build --release -Zbuild-std env: - RUSTFLAGS: '-Zlocation-detail=none -Zunstable-options -Cpanic=immediate-abort' + RUSTFLAGS: "-Zlocation-detail=none -Zunstable-options -Cpanic=immediate-abort" - name: Upload CLI binary as artifact uses: actions/upload-artifact@v7 diff --git a/.gitignore b/.gitignore index c03f402b..36fec935 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -target -*.bk .DS_Store +*.bk *.out.png -/.idea -/node_modules +/.idea/ +/node_modules/ +/target/