Skip to content

Try macos-12

Try macos-12 #117

Workflow file for this run

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: 2
jobs:
run-tests-with-ubuntu:
name: with bazel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- 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@v4
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
run: |
nix-shell --pure --run "bazel build //... $BAZEL_ARGS"
- uses: actions/cache/save@v4
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: with bazel in darwin
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=./nixpkgs.nix
- name: Configure
run: |
mkdir -p ~/repo-cache ~/disk-cache
echo common --repo_env=BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 > .bazelrc.local
echo common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 >> .bazelrc.local
echo common --incompatible_enable_cc_toolchain_resolution >> .bazelrc.local
echo common --toolchain_resolution_debug=cc >> .bazelrc.local
echo common --crosstool_top=@nixpkgs_config_cc//:toolchain >> .bazelrc.local
- name: Clean stack caches
run: rm -rf ~/.stack
- name: Mount Bazel cache
uses: actions/cache/restore@v4
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
shell: bash
run: |
set -e -o pipefail
nix-shell --pure --run 'bazel build //... $BAZEL_ARGS'
- uses: actions/cache/save@v4
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 }}