Main workflow #2297
This file contains hidden or 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: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '5 11 * * *' | |
| jobs: | |
| build-ffs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install dependencies (FUSE, attr) | |
| run: | | |
| sudo apt-get install fuse libfuse-dev pkg-config attr | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build ffs/pack/unpack and run unit tests | |
| run: | | |
| cargo build --verbose --release --bin ffs | |
| cargo test -p ffs | |
| - name: Integration tests for ffs | |
| run: PATH="$(pwd)/target/release:$PATH" ./run_tests.sh | |
| - name: Upload Linux release build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ffs | |
| path: | | |
| target/release/ffs | |
| build-pack-unpack: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Install dependencies (FUSE, attr) | |
| run: | | |
| if [ "$RUNNER_OS" = "Linux" ]; then | |
| sudo apt-get install attr | |
| elif [ "$RUNNER_OS" = "macOS" ]; then | |
| : | |
| 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 --release --bin pack | |
| cargo build --verbose --release --bin unpack | |
| cargo test -p pack -p unpack -p nodelike | |
| - name: Integration tests for pack/unpack | |
| run: PATH="$(pwd)/target/release:$PATH" ./run_tests.sh | |
| - name: Upload macOS release build | |
| uses: actions/upload-artifact@v4 | |
| if: contains(matrix.os, 'macos') | |
| with: | |
| name: packunpack.macos | |
| path: | | |
| target/release/pack | |
| target/release/unpack | |
| - name: Upload Linux release build | |
| uses: actions/upload-artifact@v4 | |
| if: contains(matrix.os, 'ubuntu') | |
| with: | |
| name: packunpack.linux | |
| path: | | |
| target/release/pack | |
| target/release/unpack | |
| benchmarks: | |
| needs: build-ffs | |
| 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/ffs | |
| PATH="$(pwd)/ffs:$PATH" FFS="$(pwd)/ffs/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 | |
| with: | |
| name: benchmarks.linux | |
| path: data | |
| prerelease: | |
| needs: | |
| - build-ffs | |
| - build-pack-unpack | |
| runs-on: ubuntu-latest | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| steps: | |
| - name: Download binaries | |
| uses: actions/download-artifact@v4 | |
| - name: Rename binaries | |
| run: | | |
| mkdir packunpack | |
| mv packunpack.linux/pack packunpack/pack.linux | |
| mv packunpack.linux/unpack packunpack/unpack.linux | |
| mv packunpack.macos/pack packunpack/pack.macos | |
| mv packunpack.macos/unpack packunpack/unpack.macos | |
| - 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 | |
| packunpack/pack.* | |
| packunpack/unpack.* | |