max 900 bytes #574
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: Checks | |
on: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
concurrency: | |
group: ${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
checks: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-12] | |
fail-fast: false | |
steps: | |
- name: Fetch source code | |
uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
if: always() # build artifacts are correct even if job fails | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
.cargo/bin/ | |
.cargo/registry/index/ | |
.cargo/registry/cache/ | |
.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-v2-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-v2- | |
- name: Set up nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
substituters = https://cache.nixos.org https://holochain.cachix.org https://holochain-ci.cachix.org | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= holochain.cachix.org-1:fWOoSTrRQ8XipZim7a8LDqFAE8aqcGnG4E7G8NAJlgY= holochain-ci.cachix.org-1:5IUSkZc0aoRS53rfkvH9Kid40NpyjwCMCzwRTXy+QN8= | |
- name: Inspect nix.conf | |
run: cat ~/.config/nix/nix.conf || true | |
- name: Cache nix with Cachix | |
if: always() # build artifacts are correct even if job fails | |
uses: cachix/cachix-action@v12 | |
with: | |
name: holochain # this is our cachix cache; we can write to it as well as read | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
# with: | |
# name: holochain-ci # this is the official holochain-ci; not always up to date; read-only for us | |
- name: Inspect nix.conf | |
run: cat ~/.config/nix/nix.conf | |
- name: Install recent bash, and set as NIX_BUILD_SHELL # needed by macos, which has an older bash incompatible with nix | |
if: ${{ runner.os == 'macOS' }} | |
run: echo "NIX_BUILD_SHELL=$(nix-build -A bashInteractive '<nixpkgs>')/bin/bash" >> $GITHUB_ENV | |
- name: Prepare Nix environment | |
run: nix develop --command bash -c "echo Completed" | |
- run: nix develop --command bash -c "bin/run build" | |
- run: nix develop --command bash -c "bin/run test" | |
- run: nix develop --command bash -c "bin/run clippy" | |
- name: Slack notify of failure | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,commit,author,ref,workflow,job | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CI }} | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} |