clippy #792
Workflow file for this run
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: "CI" | |
on: | |
push: | |
branches: | |
- "main" | |
- "ci/**" | |
pull_request: | |
jobs: | |
main: | |
runs-on: ${{ matrix.system }} | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
system: [x86_64-linux, aarch64-darwin, x86_64-darwin] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/cachix-action@v14 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: om | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
skipPush: true | |
- name: Build | |
run: | | |
# Prep systems list | |
# https://github.com/srid/nixci/issues/83 | |
mkdir ~/systems | |
echo '{ outputs = _: {}; }' > ~/systems/flake.nix | |
echo '[ "${{ matrix.system }}" ]' > ~/systems/default.nix | |
# Build all flake outputs | |
nixci \ | |
--extra-access-tokens ${{ secrets.GITHUB_TOKEN }} \ | |
build --systems "path:$HOME/systems" | |
- name: Check static binary size | |
if: matrix.system == 'x86_64-linux' | |
run: nix run .#check-closure-size | |
- name: nix build | |
if: matrix.system != 'x86_64-darwin' | |
run: echo "om_static_binary_path=$(nix build --no-link --print-out-paths)" >> "$GITHUB_ENV" | |
- name: Upload om static binary | |
if: matrix.system != 'x86_64-darwin' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: om-${{ matrix.system }} | |
path: ${{ env.om_static_binary_path }}/bin/om | |
- name: nix run | |
run: nix run . -- --help | |
- name: Tests | |
# Too slow on rosetta | |
if: matrix.system != 'x86_64-darwin' | |
run: | | |
# We disable some tests (e.g.: omnix-cli tests) on Nix due to | |
# sandboxing issues. | |
nix \ | |
--option system "${{ matrix.system }}" \ | |
--extra-access-tokens "github.com=${{ secrets.GITHUB_TOKEN }}" \ | |
develop -c cargo test | |
- name: Push to cachix | |
if: github.ref == 'refs/heads/main' | |
run: nix --option system "${{ matrix.system }}" run .#cachix-push | |
static-binary-check: | |
needs: main | |
runs-on: ${{ matrix.system }} | |
strategy: | |
matrix: | |
system: [ubuntu-latest, macos-latest] | |
steps: | |
- name: Donwload om static binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: om-${{ matrix.system == 'ubuntu-latest' && 'x86_64-linux' || matrix.system == 'macos-latest' && 'aarch64-darwin' || matrix.system }} | |
- name: Check nix installation | |
run: | | |
if which nix; then | |
echo "nix is installed, exiting" | |
exit 1 | |
elif test -d /nix; then | |
echo "/nix is present, exiting" | |
exit 1 | |
else | |
echo "nix is not installed" | |
fi | |
- name: Run om static binary | |
# By default, the shell will exit if any command fails. We want to | |
# ignore the failure of the om binary using `set +e`. | |
run: | | |
set +e | |
chmod +x ./om | |
./om health | |
if [[ $? -ne 0 ]]; then | |
echo "om binary failed due to lack of nix installation, as expected." | |
exit 0 | |
fi | |
website-build: | |
if: github.ref == 'refs/heads/main' | |
# needs: static-binary-check | |
runs-on: x86_64-linux | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the website (Nix) 🔧 | |
run: | | |
nix build ./doc -o ./_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
website-deploy: | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
runs-on: x86_64-linux | |
needs: website-build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |