Skip to content

chore: bump github/codeql-action from 2.21.7 to 2.21.8 (#9097) #2

chore: bump github/codeql-action from 2.21.7 to 2.21.8 (#9097)

chore: bump github/codeql-action from 2.21.7 to 2.21.8 (#9097) #2

name: PR unit tests (darwin)
# Triggers the workflow on push or pull request events
on: [push, pull_request]
permissions: read-all
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}-${{github.workflow}}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
name: PR unit tests (darwin)
runs-on: macos-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.*
id: go
# Retrieve build locations with `go env`
# <https://markphelps.me/posts/speed-up-your-go-builds-with-actions-cache/>
- id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Skip tests for `docs`-only changes (only works for PR-based dev workflows like Skaffold's).
# NOTE: grep output is stored in env var with `|| true` as the run command cannot fail or action will fail
- name: Check if only docs changes were made in this PR
run: |
echo ${{ github.event.before }}
echo ${{ github.event.after }}
NON_DOCS_FILES_CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.sha }}| grep -v '^docs/' || true)
echo "NON_DOCS_FILES_CHANGED=${#NON_DOCS_FILES_CHANGED}" >> $GITHUB_ENV # get the char len of diff output (used later)
- name: Run unit tests
if: ${{ env.NON_DOCS_FILES_CHANGED != 0 }}
run: |
make unit-tests
- name: Run diagnostics tests
if: ${{ env.NON_DOCS_FILES_CHANGED != 0 }}
run: |
make -f Makefile.diag coverage