mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
145 lines
4.2 KiB
YAML
145 lines
4.2 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: x86_64
|
|
toolchain: x86_64-unknown-linux-musl
|
|
- arch: aarch64
|
|
toolchain: aarch64-unknown-linux-musl
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cargo cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ matrix.toolchain }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: stable
|
|
|
|
- name: Install cross
|
|
run: cargo install --force cross
|
|
|
|
- name: Build
|
|
run: cross build --locked --release --no-default-features --features openssl-tls-static --target ${{ matrix.toolchain }}
|
|
|
|
- name: Upload binary artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: crunchy-cli-linux-${{ matrix.arch }}
|
|
path: ./target/${{ matrix.toolchain }}/release/crunchy-cli
|
|
if-no-files-found: error
|
|
|
|
- name: Upload manpages artifact
|
|
if: ${{ matrix.arch == 'x86_64' }} # only upload the manpages once
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: manpages
|
|
path: ./target/${{ matrix.toolchain }}/release/manpages
|
|
if-no-files-found: error
|
|
|
|
- name: Upload completions artifact
|
|
if: ${{ matrix.arch == 'x86_64' }} # only upload the completions once
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: completions
|
|
path: ./target/${{ matrix.toolchain }}/release/completions
|
|
if-no-files-found: error
|
|
|
|
build-mac:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
# macos-13 uses x86_64, macos-14 aarch64
|
|
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
|
|
include:
|
|
- os: macos-13
|
|
arch: x86_64
|
|
toolchain: x86_64-apple-darwin
|
|
- os: macos-14
|
|
arch: aarch64
|
|
toolchain: aarch64-apple-darwin
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cargo cache
|
|
if: ${{ matrix.os != 'macos-13' }} # when using cache, the 'Setup Rust' step fails for macos 13
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: x86_64-apple-darwin-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: stable
|
|
|
|
- name: Build
|
|
run: cargo build --locked --release --target ${{ matrix.toolchain }}
|
|
|
|
- name: Upload binary artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: crunchy-cli-darwin-${{ matrix.arch }}
|
|
path: ./target/${{ matrix.toolchain }}/release/crunchy-cli
|
|
if-no-files-found: error
|
|
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cargo cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: x86_64-pc-windows-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install system dependencies
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
update: true
|
|
install: mingw-w64-x86_64-rust base-devel
|
|
|
|
- name: Build
|
|
shell: msys2 {0}
|
|
run: cargo build --locked --release --target x86_64-pc-windows-gnu
|
|
|
|
- name: Upload binary artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: crunchy-cli-windows-x86_64
|
|
path: ./target/x86_64-pc-windows-gnu/release/crunchy-cli.exe
|
|
if-no-files-found: error
|