Skip to content

Commit

Permalink
CI: reorganize matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
ahihi committed Aug 2, 2024
1 parent f670345 commit c3ac9fc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
platform:
- target: x86_64-unknown-linux-gnu
- target: aarch64-unknown-linux-gnu
- target: x86_64-pc-windows-msvc
- target: i686-pc-windows-msvc
- target: x86_64-apple-darwin
- target: aarch64-apple-darwin

include:
- target: x86_64-unknown-linux-gnu
Expand All @@ -42,7 +42,7 @@ jobs:

env:
PROJECT_NAME: autocrap
CARGO_BUILD_TARGET: ${{ matrix.target }}
CARGO_BUILD_TARGET: ${{ matrix.platform.target }}
CARGO_TERM_COLOR: always
MACOSX_DEPLOYMENT_TARGET: 10.12
RUSTFLAGS:
Expand All @@ -62,14 +62,14 @@ jobs:
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
target: ${{ matrix.target }}
target: ${{ matrix.platform.target }}
args: "--verbose"
strip: true

- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-${{ matrix.target }}
name: ${{ env.PROJECT_NAME }}-${{ matrix.platform.target }}
path: |
target/${{ matrix.target }}/debug/${{ env.PROJECT_NAME }}
target/${{ matrix.target }}/debug/${{ env.PROJECT_NAME }}.exe
target/${{ matrix.platform.target }}/debug/${{ env.PROJECT_NAME }}
target/${{ matrix.platform.target }}/debug/${{ env.PROJECT_NAME }}.exe
28 changes: 17 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ jobs:

strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
platform:
- target: x86_64-unknown-linux-gnu
name: linux-x86_64
- target: aarch64-unknown-linux-gnu
name: linux-aarch64
- target: x86_64-pc-windows-msvc
name: windows-x86_64
- target: i686-pc-windows-msvc
name: windows-i686
- target: x86_64-apple-darwin
name: macos-x86_64
- target: aarch64-apple-darwin
name: macos-aarch64

env:
PROJECT_NAME: autocrap
Expand All @@ -42,23 +48,23 @@ jobs:
version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "'"$PROJECT_NAME"'").version')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: retrieve ${{ matrix.target }} binary
- name: retrieve ${{ matrix.platform.target }} binary
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
commit: ${{ env.GITHUB_SHA }}
name: ${{ env.PROJECT_NAME }}-${{ matrix.target }}
name: ${{ env.PROJECT_NAME }}-${{ matrix.platform.target }}
path: target

- name: build archives
working-directory: target
run: |
ARCHIVE_NAME='${{ env.PROJECT_NAME }}-${{ steps.meta.outputs.version }}-${{ matrix.target }}'
ARCHIVE_NAME='${{ env.PROJECT_NAME }}-${{ steps.meta.outputs.version }}-${{ matrix.platform.name }}'
echo "ARCHIVE_NAME=$ARCHIVE_NAME"
mkdir "$ARCHIVE_NAME"
case '${{ matrix.target }}' in
case '${{ matrix.platform.target }}' in
*-windows-*)
cp -a "${PROJECT_NAME}.exe" "$ARCHIVE_NAME"
zip "${ARCHIVE_NAME}.zip" "$ARCHIVE_NAME"/*
Expand Down

0 comments on commit c3ac9fc

Please sign in to comment.