59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["*"]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
binary: ccsm
|
|
archive: ccsm-linux-amd64.tar.gz
|
|
- target: x86_64-apple-darwin
|
|
binary: ccsm
|
|
archive: ccsm-darwin-amd64.tar.gz
|
|
- target: x86_64-pc-windows-gnu
|
|
binary: ccsm.exe
|
|
archive: ccsm-windows-amd64.zip
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
run: rustup update stable && rustup default stable
|
|
|
|
- name: Build (Linux)
|
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
run: cargo build --release
|
|
|
|
- name: Install cross
|
|
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: |
|
|
cd "target/${{ matrix.target }}/release"
|
|
if [[ "${{ matrix.target }}" == *-windows-* ]]; then
|
|
zip "${{ matrix.archive }}" "${{ matrix.binary }}"
|
|
else
|
|
tar czf "${{ matrix.archive }}" "${{ matrix.binary }}"
|
|
fi
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.archive }}
|
|
path: target/${{ matrix.target }}/release/${{ matrix.archive }}
|