Skip to content

Update rules_nixpkgs in example #72

Update rules_nixpkgs in example

Update rules_nixpkgs in example #72

Workflow file for this run

name: Build & test
on:
push:
env:
# Bump this number to invalidate the GH actions cache
cache-version: 0
jobs:
test:
name: Run test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-11
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install NixOS
uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=./nixpkgs.nix
- name: Configure
run: |
mkdir -p ~/repo-cache ~/disk-cache
- 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: Build all
run: |
nix-shell --pure --run 'bazel build //... --sandbox_debug --verbose_failures --repository_cache=~/repo-cache --disk_cache=~/disk-cache'
nix-shell --pure --run 'cd tests; bazel build //... --sandbox_debug --verbose_failures --repository_cache=~/repo-cache --disk_cache=~/disk-cache'
- name: Run tests
run: |
nix-shell --pure --run 'cd tests; bazel run clotestbin'
nix-shell --pure --run 'cd tests; bazel run clotestbin-cc'
nix-shell --pure --run 'cd tests; bazel run hello-java'
- name: Run buildifier
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]
then
nix-shell --pure --run 'bazel run //buildifier:buildifier-diff'
else
echo "skipping buildifier in macos"
fi
- 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 }}