Skip to content

Commit

Permalink
chore(ci): Align ci and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyscot committed Oct 31, 2024
1 parent 4fbf8f8 commit e236062
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 39 deletions.
78 changes: 46 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
target: x86_64-unknown-linux-musl
rust: stable
build_deb: true
- build: aarch64-musl
host: ubuntu-latest
target: aarch64-unknown-linux-musl
rust: stable
build_deb: true
#- build: aarch64-musl
# host: ubuntu-latest
# target: aarch64-unknown-linux-musl
# rust: stable
# build_deb: true
runs-on: ${{ matrix.host }}
steps:
- uses: actions/checkout@v4
Expand All @@ -49,16 +49,30 @@ jobs:
with:
key: "${{ matrix.build }}"
cache-on-failure: true
- name: install packages (ubuntu hosts only)
workspaces: |
. -> target
. -> target/${{ matrix.target }}
- name: install packages (ubuntu builds only)
if: startsWith(matrix.host, 'ubuntu')
run: scripts/install-ubuntu-packages
# native builds need all of these; cross builds only need binutils-multiarch

- name: Build
run: cross build --release --locked --target ${{ matrix.target }}
#- name: Build
# run: cross build --release --locked --target ${{ matrix.target }}
- uses: taiki-e/upload-rust-binary-action@v1
id: build
with:
bin: qcp
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ matrix.target }}
include: README.md,LICENSE,CHANGELOG.md
leading-dir: true
tar: unix
zip: windows
dry_run: true
- name: Make debian package
if: ${{ matrix.build_deb }}
run: scripts/make-debian-package ${{ matrix.target }}

- name: Upload binary
uses: actions/upload-artifact@v4
with:
Expand All @@ -69,28 +83,28 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: qcp-deb-${{ matrix.target }}
path: target/**/debian/qcp*.deb
path: ${{ env.BUILT_DEB_FILE }}

# We only need to run the checks on a single platform
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
key: checks
cache-on-failure: true
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: install packages
run: scripts/install-ubuntu-packages
# Checks begin here!
- run: cargo fmt --all -- --check
- run: cargo test --locked
- run: cargo clippy --locked --all-targets
# We care that the benchmarks build and run, not about their numeric output.
# To keep the CI a bit leaner, do this in the dev profile.
- run: cargo build --locked --all-targets
- run: cargo doc --no-deps --locked
# checks:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: Swatinem/rust-cache@v2
# with:
# key: checks
# cache-on-failure: true
# - name: Install Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# - name: install packages
# run: scripts/install-ubuntu-packages
# # Checks begin here!
# - run: cargo fmt --all -- --check
# - run: cargo test --locked
# - run: cargo clippy --locked --all-targets
# # We care that the benchmarks build and run, not about their numeric output.
# # To keep the CI a bit leaner, do this in the dev profile.
# - run: cargo build --locked --all-targets
# - run: cargo doc --no-deps --locked
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ name: release
on:
release:
types: [published]
# running on push is sometimes useful for testing; also enable WORKFLOW_TEST
#push:
# branches:
# - misc/build-aarch64
workflow_dispatch: # for testing

env:
WORKFLOW_TEST: false
CARGO_TERM_COLOR: always
WORKFLOW_TEST: GITHUB_EVENT_NAME == 'workflow_dispatch'

permissions:
contents: write
Expand All @@ -23,10 +21,12 @@ jobs:
host: ubuntu-latest
target: x86_64-unknown-linux-musl
rust: stable
build_deb: true
- build: aarch64-musl
host: ubuntu-latest
target: aarch64-unknown-linux-musl
rust: stable
build_deb: true
runs-on: ${{ matrix.host }}
steps:
- uses: actions/checkout@v4
Expand All @@ -37,7 +37,7 @@ jobs:
targets: ${{ matrix.target }}
- uses: taiki-e/install-action@v2
with:
tool: cross
tool: cross,cargo-deb
- uses: Swatinem/rust-cache@v2
with:
key: "${{matrix.build}}"
Expand Down
4 changes: 3 additions & 1 deletion scripts/make-debian-package
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ fi
set -x

gzip -9n < CHANGELOG.md > misc/changelog.gz
cargo deb --no-build --locked ${TARGETOPT} --deb-revision ""
output=$(cargo deb --no-build --locked ${TARGETOPT} --deb-revision "")
: $output
echo "BUILT_DEB_FILE=$(echo $output | grep -E '.deb$')" >> "$GITHUB_ENV"

0 comments on commit e236062

Please sign in to comment.