Skip to content

chore: enable some CI on macos again #961

chore: enable some CI on macos again

chore: enable some CI on macos again #961

Workflow file for this run

name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
matrix-prep-bazelversion:
# Prepares the 'bazelversion' axis of the test matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: bazel_6
run: echo "bazelversion=$(head -n 1 .bazelversion)" >> $GITHUB_OUTPUT
# - id: bazel_5
# run: echo "bazelversion=5.3.2" >> $GITHUB_OUTPUT
outputs:
# Will look like ["<version from .bazelversion>", "5.3.2"]
bazelversions: ${{ toJSON(steps.*.outputs.bazelversion) }}
matrix-prep-os:
# Prepares the 'os' axis of the test matrix
runs-on: ubuntu-latest
env:
TC_CLOUD_TOKEN: ${{ secrets.TC_CLOUD_TOKEN }}
steps:
- id: linux
run: echo "os=ubuntu-latest" >> $GITHUB_OUTPUT
- id: rbe
run: echo "os=macos-latest" >> $GITHUB_OUTPUT
# Don't run MocOS if there is no TestContainers API token which is the case on forks
# We expect to use it at some point for tests that need a docker daemon.
if: ${{ env.TC_CLOUD_TOKEN != '' }}
outputs:
# Will look like ["ubuntu-latest", "macos-latest"]
os: ${{ toJSON(steps.*.outputs.os) }}
test:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
needs:
- matrix-prep-bazelversion
- matrix-prep-os
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(needs.matrix-prep-os.outputs.os) }}
bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }}
folder:
- .
# - e2e/custom_registry
# - e2e/wasm
# - e2e/smoke
# - e2e/crane_as_registry
bzlmodEnabled: [false] # [true, false]
exclude:
# Don't test bzlmod with Bazel 5 (not supported)
- bazelversion: 5.3.2
bzlmodEnabled: true
# TODO: fix
- folder: e2e/custom_registry
bzlmodEnabled: true
# TODO: fix
- folder: e2e/wasm
bzlmodEnabled: true
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# - name: Mount bazel caches
# uses: actions/cache@v3
# with:
# path: |
# ~/.cache/bazel
# ~/.cache/bazel-repo
# key: bazel-cache-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }}
# restore-keys: |
# bazel-cache-${{ matrix.os }}-${{ matrix.folder }}
# bazel-cache-${{ matrix.os }}
# bazel-cache-
- name: Set bzlmod flag
# Store the --enable_bzlmod flag that we add to the test command below
# only when we're running bzlmod in our test matrix.
id: set_bzlmod_flag
if: matrix.bzlmodEnabled
run: echo "bzlmod_flag=--enable_bzlmod" >> $GITHUB_OUTPUT
- name: Configure Bazel version
working-directory: ${{ matrix.folder }}
run: echo "${{ matrix.bazelversion }}" > .bazelversion
- name: Configure TestContainers cloud
if: ${{ matrix.os == 'macos-latest' }}
env:
TC_CLOUD_TOKEN: ${{ secrets.TC_CLOUD_TOKEN }}
uses: atomicjar/testcontainers-cloud-setup-action@main
- name: Setup upterm session
uses: lhotari/action-upterm@v1
- name: bazel test //...
working-directory: ${{ matrix.folder }}
if: ${{ false }}
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test ${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} //...
# test-auth:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup bats
# uses: mig4/setup-bats@v1
# with:
# bats-version: "1.8.2"
# - name: Setup bats helpers
# uses: brokenpip3/[email protected]
# with:
# support-path: /usr/lib/bats/bats-support
# support-version: "0.3.0"
# assert-path: /usr/lib/bats/bats-assert
# assert-version: "2.1.0"
# - name: bats -r .
# working-directory: e2e/auth
# run: |
# for i in {1..5}; do bats -r . && break || sleep 5; done
# - name: bats -r . --enable_bzlmod
# working-directory: e2e/auth
# run: |
# echo "build --enable_bzlmod" >> .bazelrc.user
# for i in {1..5}; do bats -r . && break || sleep 5; done