Switch to cross-compilation via cross-rs
Build / build (ccsm-darwin-amd64.tar.gz, ccsm, x86_64-apple-darwin) (push) Failing after 6s
Build / build (ccsm-linux-amd64.tar.gz, ccsm, x86_64-unknown-linux-gnu) (push) Failing after 7s
Build / build (ccsm-windows-amd64.zip, ccsm.exe, x86_64-pc-windows-gnu) (push) Failing after 7s
Build / build (ccsm-darwin-amd64.tar.gz, ccsm, x86_64-apple-darwin) (push) Failing after 6s
Build / build (ccsm-linux-amd64.tar.gz, ccsm, x86_64-unknown-linux-gnu) (push) Failing after 7s
Build / build (ccsm-windows-amd64.zip, ccsm.exe, x86_64-pc-windows-gnu) (push) Failing after 7s
Build all targets (Linux, macOS, Windows) from a single Linux runner using `cross` for macOS and Windows targets. Linux target builds natively without cross.
This commit is contained in:
+25
-29
@@ -9,54 +9,50 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- target: x86_64-unknown-linux-gnu
|
||||||
runs-on: ubuntu-latest
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
binary: ccsm
|
binary: ccsm
|
||||||
archive: ccsm-linux-amd64.tar.gz
|
archive: ccsm-linux-amd64.tar.gz
|
||||||
- os: macos
|
- target: x86_64-apple-darwin
|
||||||
runs-on: macos-latest
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
binary: ccsm
|
binary: ccsm
|
||||||
archive: ccsm-darwin-amd64.tar.gz
|
archive: ccsm-darwin-amd64.tar.gz
|
||||||
- os: windows
|
- target: x86_64-pc-windows-gnu
|
||||||
runs-on: windows-latest
|
|
||||||
target: x86_64-pc-windows-msvc
|
|
||||||
binary: ccsm.exe
|
binary: ccsm.exe
|
||||||
archive: ccsm-windows-amd64.zip
|
archive: ccsm-windows-amd64.zip
|
||||||
|
|
||||||
runs-on: ${{ matrix.runs-on }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust
|
||||||
uses: https://gitea.com/actions/rust-toolchain@v1
|
run: rustup update stable && rustup default stable
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
target: ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build (Linux)
|
||||||
run: cargo build --release --target ${{ matrix.target }}
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
||||||
|
run: cargo build --release
|
||||||
|
|
||||||
- name: Package (linux / macos)
|
- name: Install cross
|
||||||
if: matrix.os != 'windows'
|
if: matrix.target != 'x86_64-unknown-linux-gnu'
|
||||||
|
run: cargo install cross --locked
|
||||||
|
|
||||||
|
- name: Build with cross
|
||||||
|
if: matrix.target != 'x86_64-unknown-linux-gnu'
|
||||||
|
run: cross build --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
cd target/${{ matrix.target }}/release
|
cd "target/${{ matrix.target }}/release"
|
||||||
tar czf ${{ matrix.archive }} ${{ matrix.binary }}
|
if [[ "${{ matrix.target }}" == *-windows-* ]]; then
|
||||||
|
zip "${{ matrix.archive }}" "${{ matrix.binary }}"
|
||||||
- name: Package (windows)
|
else
|
||||||
if: matrix.os == 'windows'
|
tar czf "${{ matrix.archive }}" "${{ matrix.binary }}"
|
||||||
run: |
|
fi
|
||||||
cd target\${{ matrix.target }}\release
|
|
||||||
7z a ${{ matrix.archive }} ${{ matrix.binary }}
|
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ccsm-${{ matrix.os }}-amd64
|
name: ${{ matrix.archive }}
|
||||||
path: target/${{ matrix.target }}/release/${{ matrix.archive }}
|
path: target/${{ matrix.target }}/release/${{ matrix.archive }}
|
||||||
|
|||||||
Reference in New Issue
Block a user