Skip to content

Test

Test #126

Workflow file for this run

# Build on push and pull request.
# If a tag like "v0.1.2" is pushed, create a draft release with built binaries and changelog.
name: Build
on: [push, pull_request, workflow_dispatch]
env:
CARGO_TERM_COLOR: always
jobs:
create-draft-release:
runs-on: ubuntu-latest
outputs:
release_upload_url: ${{ steps.create-draft-release.outputs.upload_url }}
steps:
- name: Create draft release
id: create-draft-release
uses: ncipollo/release-action@v1
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
with:
draft: true
generateReleaseNotes: true
build-and-upload-artifact:
needs: create-draft-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# - os: ubuntu-latest
# target: x86_64-unknown-linux-gnu
# artifact-name: ubuntu-x64
# prebuild-config: |
# sudo apt-get update
# sudo apt-get install -y libasound2-dev
# - os: ubuntu-24.04-arm
# target: aarch64-unknown-linux-gnu
# artifact-name: ubuntu-arm64
# prebuild-config: |
# sudo apt-get update
# sudo apt-get install -y libasound2-dev
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# artifact-name: windows-x64
# prebuild-config:
- os: windows-11-arm
target: aarch64-pc-windows-msvc
artifact-name: windows-arm64
prebuild-config:
# - os: macos-15-intel
# target: x86_64-apple-darwin
# artifact-name: macos-x64
# prebuild-config:
# - os: macos-latest
# target: aarch64-apple-darwin
# artifact-name: macos-arm64
# prebuild-config:
steps:
- uses: actions/checkout@v3
- name: Set exe extension for Windows
run: echo "EXE=.exe" >> $env:GITHUB_ENV
if: startsWith(matrix.os, 'windows')
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal # minimal component installation (ie, no documentation)
target: ${{ matrix.target }}
- name: Prebuild config
run: ${{ matrix.prebuild-config }}
- name: Build
run: cargo build --release --target=${{ matrix.target }}
- name: Run tests
run: cargo test --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: target/${{ matrix.target }}/release/code-radio${{ env.EXE }}
- name: Get version from tag
id: extract-version
run: |
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
shell: bash
- name: Upload artifact to release
uses: shogo82148/actions-upload-release-asset@v1
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
with:
upload_url: ${{ needs.create-draft-release.outputs.release_upload_url }}
asset_name: code-radio-${{ steps.extract-version.outputs.version }}-${{ matrix.artifact-name }}${{ env.EXE }}
asset_path: target/${{ matrix.target }}/release/code-radio${{ env.EXE }}