Main workflow #1617
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main workflow | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: '5 11 * * *' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install dependencies (FUSE, attr) | |
run: | | |
if [ "$RUNNER_OS" = "Linux" ]; then | |
sudo apt-get install fuse libfuse-dev pkg-config attr | |
elif [ "$RUNNER_OS" = "macOS" ]; then | |
brew install macfuse pkg-config | |
else | |
echo Unsupported RUNNER_OS=$RUNNER_OS | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build ffs/pack/unpack and run unit tests | |
run: | | |
cargo build --verbose --all --release | |
cargo test | |
- name: Integration tests for ffs and pack/unpack (Linux) | |
if: contains(matrix.os, 'ubuntu') | |
run: PATH="$(pwd)/target/release:$PATH" ./run_tests.sh | |
- name: Integration tests for pack/unpack only (macOS) | |
if: contains(matrix.os, 'macos') | |
run: PATH="$(pwd)/target/release:$PATH" ./run_tests.sh unpack | |
- name: Upload macOS release build | |
uses: actions/upload-artifact@v4 | |
if: contains(matrix.os, 'macos') | |
with: | |
name: ffs.macos | |
path: | | |
target/release/ffs | |
target/release/pack | |
target/release/unpack | |
- name: Upload Linux release build | |
uses: actions/upload-artifact@v4 | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
name: ffs.linux | |
path: | | |
target/release/ffs | |
target/release/pack | |
target/release/unpack | |
benchmarks: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies (FUSE, attr) | |
run: | | |
if [ "$RUNNER_OS" = "Linux" ]; then | |
sudo apt-get install fuse libfuse-dev pkg-config attr | |
else | |
echo Unsupported RUNNER_OS=$RUNNER_OS | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Benchmarks | |
run: | | |
Rscript -e "tries <- 0; while (!require('ggplot2') && tries < 3) { cat(sprintf('TRY %d\n', tries)); install.packages('ggplot2', repos = 'https://cloud.r-project.org/'); tries <- tries + 1; }" | |
chmod +x $(pwd)/ffs.linux/ffs | |
PATH="$(pwd)/ffs.linux:$PATH" FFS="$(pwd)/ffs.linux/ffs" ./run_bench.sh -n 3 | |
# grab latest directory (output of run_bench) | |
DATADIR=bench/$(ls -ct bench/ | head -n 1) | |
[ -d $DATADIR ] && ls $DATADIR | grep log >/dev/null || { echo "No log files found in $DATADIR. What's going on?"; tree bench; exit 1; } | |
mkdir data | |
for x in $DATADIR/* | |
do | |
mv $x data/${x##*_} | |
done | |
- name: Upload Linux benchmark data | |
uses: actions/upload-artifact@v4 | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
name: benchmarks.linux | |
path: data | |
prerelease: | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
- name: Rename binaries | |
run: | | |
mkdir ffs | |
mv ffs.linux/ffs ffs/ffs.linux | |
mv ffs.linux/pack ffs/pack.linux | |
mv ffs.linux/unpack ffs/unpack.linux | |
if [ -d ffs.macos ] | |
then | |
mv ffs.macos/ffs ffs/ffs.macos | |
mv ffs.macos/pack ffs/pack.macos | |
mv ffs.macos/unpack ffs/unpack.macos | |
else | |
echo "macOS is disabled 😢" | |
fi | |
- name: Deploy 'latest' release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Latest development build" | |
files: | | |
ffs/ffs.* | |
ffs/pack.* | |
ffs/unpack.* | |