Skip to content

CI

CI #279

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- 'v*'
paths-ignore:
- 'assets/**'
- 'docs/**'
- 'scripts/**'
- 'README.md'
- 'CHANGELOG.md'
- '.github/workflows/**'
pull_request:
paths-ignore:
- 'assets/**'
- 'docs/**'
- 'scripts/**'
- 'README.md'
- 'CHANGELOG.md'
- '.github/workflows/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
test:
name: Test
uses: ./.github/workflows/test.yml
build:
name: Build (${{ matrix.target }})
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: tar.gz
# macOS builds were temporarily disabled Nov 2025 due to hashFiles regression.
# Runner images have been rolled back. If issues recur, see:
# https://github.com/actions/runner-images/issues/13341
# https://github.com/actions/runner/issues/4134
# macOS Intel
- os: macos-13
target: x86_64-apple-darwin
ext: tar.gz
# macOS Apple Silicon
- os: macos-latest
target: aarch64-apple-darwin
ext: tar.gz
# Windows x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: zip
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Build frontend
run: |
cd frontend
npm ci
npm run build
echo "Frontend built successfully"
- name: Build release binary
env:
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare release artifact
shell: bash
run: |
mkdir dist
bin_name=fspulse
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
bin_name=fspulse.exe
fi
# Strip debug symbols (where supported)
strip target/${{ matrix.target }}/release/$bin_name || true
# Copy binary into dist/
cp target/${{ matrix.target }}/release/$bin_name dist/$bin_name
echo "Contents of dist:"
ls -lh dist/
cd dist
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="dev"
fi
archive_name=fspulse-v$version-${{ matrix.target }}.${{ matrix.ext }}
if [[ "${{ matrix.ext }}" == "zip" ]]; then
7z a ../$archive_name * > /dev/null
else
tar -czf ../$archive_name *
fi
cd ..
- name: Upload GitHub Release asset
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
files: fspulse-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.ext }}
- name: Upload build artifact (dev builds)
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: fspulse-${{ matrix.target }}
path: dist/
retention-days: 7
release:
name: Create GitHub Release
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Read changelog for this version
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: ${{ github.ref_name }}
path: ./CHANGELOG.md
- name: Create or update GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}