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>
This commit is contained in:
Alejandro González 2026-05-08 23:25:01 +02:00
parent 028294cc8c
commit 4e80dd009a
No known key found for this signature in database
5 changed files with 34 additions and 15 deletions

View file

@ -1,4 +1,7 @@
scripts
.github
.editorconfig .editorconfig
.pre-commit-hooks.yaml .gitignore
/.git/
/.github/
/.pre-commit-hooks.yaml
/scripts/
/target/

View file

@ -3,7 +3,12 @@ name: deploy
on: on:
push: push:
tags: 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: permissions:
actions: read actions: read
@ -54,15 +59,15 @@ jobs:
- name: Get the Oxipng version - name: Get the Oxipng version
id: oxipngMeta id: oxipngMeta
run: run: >
echo "version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "oxipng").version')" echo "version=$(cargo metadata --format-version 1 --no-deps |
>> "$GITHUB_OUTPUT" jq -r '.packages[] | select(.name == "oxipng").version')" >> "$GITHUB_OUTPUT"
- name: Retrieve ${{ matrix.target }} binary - name: Retrieve ${{ matrix.target }} binary
uses: dawidd6/action-download-artifact@v21 uses: dawidd6/action-download-artifact@v21
with: with:
workflow: oxipng.yml workflow: oxipng.yml
commit: ${{ env.GITHUB_SHA }} commit: ${{ github.sha }}
name: Oxipng binary (${{ matrix.target }}) name: Oxipng binary (${{ matrix.target }})
path: target path: target

View file

@ -2,9 +2,9 @@ name: docker
on: on:
push: push:
branches: branches:
- 'master' - master
tags: tags:
- 'v*.*.*' - v*.*.*
pull_request: pull_request:
types: types:
- opened - opened
@ -17,6 +17,12 @@ on:
type: boolean type: boolean
default: true 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: jobs:
build: build:
uses: docker/github-builder/.github/workflows/build.yml@v1 uses: docker/github-builder/.github/workflows/build.yml@v1

View file

@ -8,6 +8,11 @@ on:
- synchronize - synchronize
workflow_dispatch: 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: jobs:
ci: ci:
name: CI name: CI
@ -126,7 +131,7 @@ jobs:
- name: Build CLI binary - name: Build CLI binary
run: cargo build --release -Zbuild-std run: cargo build --release -Zbuild-std
env: 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 - name: Upload CLI binary as artifact
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7

8
.gitignore vendored
View file

@ -1,6 +1,6 @@
target
*.bk
.DS_Store .DS_Store
*.bk
*.out.png *.out.png
/.idea /.idea/
/node_modules /node_modules/
/target/