Update rules_haskell #37
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: Build & test | |
on: [push] | |
env: | |
BAZEL_ARGS: --repository_cache=~/repo-cache --disk_cache=~/disk-cache | |
# Bump this number to invalidate the GH actions cache | |
cache-version: 0 | |
jobs: | |
run-tests-with-ubuntu: | |
name: Run Tests with ubuntu runner | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v22 | |
- name: Configure | |
run: | | |
mkdir -p ~/repo-cache ~/disk-cache | |
echo build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host > .bazelrc.local | |
- name: Mount Bazel cache | |
uses: actions/cache/restore@v3 | |
if: github.ref != 'refs/heads/master' | |
id: restore-cache | |
with: | |
path: | | |
~/repo-cache | |
~/disk-cache | |
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}-${{ github.run_id }}-${{ github.run_attempt }} | |
restore-keys: | | |
repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}- | |
- run: | | |
nix-shell --pure --run "bazel test --test_output=all //... $BAZEL_ARGS" | |
- uses: actions/cache/save@v3 | |
if: github.ref == 'refs/heads/master' | |
with: | |
path: | | |
~/repo-cache | |
~/disk-cache | |
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}-${{ github.run_id }}-${{ github.run_attempt }} | |
run-tests-with-darwin: | |
name: Run Tests with darwin runner | |
runs-on: macos-11 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install NixOS | |
uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=./nixpkgs.nix | |
- name: Configure | |
run: | | |
mkdir -p ~/repo-cache ~/disk-cache | |
echo build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host > .bazelrc.local | |
- name: Mount Bazel cache | |
uses: actions/cache/restore@v3 | |
if: github.ref != 'refs/heads/master' | |
id: restore-cache | |
with: | |
path: | | |
~/repo-cache | |
~/disk-cache | |
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}-${{ github.run_id }}-${{ github.run_attempt }} | |
restore-keys: | | |
repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}- | |
- name: Prefetch Stackage snapshot | |
shell: bash | |
run: | | |
set -e -o pipefail | |
nix-shell --pure --run "cmd='bazel fetch @stackage//... $BAZEL_ARGS'; \$cmd || \$cmd || \$cmd" | |
- name: Build all | |
shell: bash | |
run: | | |
set -e -o pipefail | |
nix-shell --pure --run 'bazel build //... $BAZEL_ARGS' | |
- name: Run tests | |
shell: bash | |
run: | | |
set -e -o pipefail | |
# Keep CI awake | |
while true; do echo "."; sleep 60; done & | |
nix-shell --pure --run 'bazel test //... $BAZEL_ARGS' | |
- uses: actions/cache/save@v3 | |
if: github.ref == 'refs/heads/master' | |
with: | |
path: | | |
~/repo-cache | |
~/disk-cache | |
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}-${{ github.run_id }}-${{ github.run_attempt }} | |