Split ci platforms in separate jobs

This commit is contained in:
bytedream 2023-07-20 18:07:32 +02:00
parent 00e8082e66
commit 068c0fcac1

View file

@ -8,23 +8,8 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build: build-linux:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-latest
toolchain: x86_64-unknown-linux-musl
platform: linux
ext:
- os: windows-latest
toolchain: x86_64-pc-windows-gnu
platform: windows
ext: .exe
- os: macos-latest
toolchain: x86_64-apple-darwin
platform: darwin
ext:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -41,35 +26,100 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies - name: Install system dependencies
if: matrix.platform == 'linux'
run: sudo apt-get install musl-tools run: sudo apt-get install musl-tools
- name: Install toolchain - name: Install toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: stable
target: ${{ matrix.toolchain }} target: x86_64-unknown-linux-musl
- name: Build - name: Build
run: cargo build --release --all-features --target ${{ matrix.toolchain }} run: cargo build --release --all-features --target x86_64-unknown-linux-musl
- name: Upload binary artifact - name: Upload binary artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: crunchy-cli_${{ matrix.platform }} name: crunchy-cli_linux
path: ./target/${{ matrix.toolchain }}/release/crunchy-cli${{ matrix.ext }} path: ./target/x86_64-unknown-linux-musl/release/crunchy-cli
if-no-files-found: error if-no-files-found: error
- name: Upload manpages artifact - name: Upload manpages artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: manpages name: manpages
path: ./target/${{ matrix.toolchain }}/release/manpages path: ./target/x86_64-unknown-linux-musl/release/manpages
if-no-files-found: error if-no-files-found: error
- name: Upload completions artifact - name: Upload completions artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: completions name: completions
path: ./target/${{ matrix.toolchain }}/release/completions path: ./target/x86_64-unknown-linux-musl/release/completions
if-no-files-found: error
build-mac:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-apple-darwin
- name: Build
run: cargo build --release --all-features --target x86_64-apple-darwin
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: crunchy-cli_darwin
path: ./target/x86_64-apple-darwin/release/crunchy-cli
if-no-files-found: error
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
uses: msys2/setup-msys2@v2
with:
install: mingw-w64-x86_64-rust base-devel
- name: Build
shell: msys2 {0}
run: cargo build --release --all-features --target x86_64-pc-windows-gnu
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: crunchy-cli_windows
path: ./target/x86_64-pc-windows-gnu/release/crunchy-cli.exe
if-no-files-found: error if-no-files-found: error