Skip to content

Update CI

Update CI #61

Workflow file for this run

name: Release
on:
push:
pull_request:
jobs:
build:
strategy:
fail-fast: false
matrix:
targets: [
{ bin: gyro2bb, os: ubuntu-latest, target: x86_64-unknown-linux-musl, tool: cargo, name: linux64, ext: '' },
{ bin: gyro2bb, os: ubuntu-latest, target: i686-unknown-linux-musl, tool: cross, name: linux32, ext: '' },
{ bin: gyro2bb, os: ubuntu-latest, target: aarch64-unknown-linux-musl, tool: cross, name: linux-arm64, ext: '' },
{ bin: gyro2bb, os: macos-latest, target: x86_64-apple-darwin, tool: cargo, name: mac64, ext: '' },
{ bin: gyro2bb, os: macos-latest, target: aarch64-apple-darwin, tool: cross, name: mac-arm64, ext: '' },
{ bin: gyro2bb, os: windows-latest, target: x86_64-pc-windows-msvc, tool: cargo, name: windows64, ext: '.exe' },
{ bin: gyro2bb, os: windows-latest, target: i686-pc-windows-msvc, tool: cargo, name: windows32, ext: '.exe' },
{ bin: gyro2bb, os: windows-latest, target: aarch64-pc-windows-msvc, tool: cargo, name: windows-arm64, ext: '.exe' },
{ bin: gopro-gps, os: ubuntu-latest, target: x86_64-unknown-linux-musl, tool: cargo, name: linux64, ext: '' },
{ bin: gopro-gps, os: ubuntu-latest, target: i686-unknown-linux-musl, tool: cross, name: linux32, ext: '' },
{ bin: gopro-gps, os: ubuntu-latest, target: aarch64-unknown-linux-musl, tool: cross, name: linux-arm64, ext: '' },
{ bin: gopro-gps, os: macos-latest, target: x86_64-apple-darwin, tool: cargo, name: mac64, ext: '' },
{ bin: gopro-gps, os: macos-latest, target: aarch64-apple-darwin, tool: cross, name: mac-arm64, ext: '' },
{ bin: gopro-gps, os: windows-latest, target: x86_64-pc-windows-msvc, tool: cargo, name: windows64, ext: '.exe' },
{ bin: gopro-gps, os: windows-latest, target: i686-pc-windows-msvc, tool: cargo, name: windows32, ext: '.exe' },
{ bin: gopro-gps, os: windows-latest, target: aarch64-pc-windows-msvc, tool: cargo, name: windows-arm64, ext: '.exe' }
]
runs-on: ${{ matrix.targets.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.targets.target }}"
- uses: Swatinem/rust-cache@v2
- name: Add rust target
run: rustup target add ${{ matrix.targets.target }}
- name: Setup target ${{ matrix.targets.target }}
if: ${{ matrix.targets.target == 'aarch64-apple-darwin' }}
run: |
echo "SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Install cross
if: ${{ matrix.targets.tool == 'cross' }}
run: cargo install cross
- name: Build ${{ matrix.targets.bin }}
working-directory: bin/${{ matrix.targets.bin }}/
run: ${{ matrix.targets.tool }} build --target ${{ matrix.targets.target }} --release
- name: Strip
if: ${{ matrix.targets.os != 'windows-latest' }}
continue-on-error: true
working-directory: bin/${{ matrix.targets.bin }}/
run: strip target/${{ matrix.targets.target }}/release/${{ matrix.targets.bin }} 2>/dev/null || true
- name: Copy dist
working-directory: bin/${{ matrix.targets.bin }}/
run: |
mkdir ../../dist
mv target/${{ matrix.targets.target }}/release/${{ matrix.targets.bin }}${{ matrix.targets.ext }} ../../dist/${{ matrix.targets.bin }}-${{ matrix.targets.name }}${{ matrix.targets.ext }}
- name: Save Binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.targets.bin }}-${{ matrix.targets.name }}
path: dist/${{ matrix.targets.bin }}*
github_release:
name: Create GitHub release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- run: ls -l
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./*