-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (55 loc) · 1.74 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
name: Run unit tests
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Location to store the bazelisk executable
BAZELISK_BIN_DIR: .bazelisk-bin
# Version of the bazelisk to use
BAZELISK_VERSION: v1.19.0/bazelisk-linux-amd64
jobs:
unit-tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Try to restore build cache
uses: actions/cache/store@v4
with:
path: .cache
key: ${{ runner.os }}-build
- name: Try to restore bazelisk binary
id: cache-bazelisk-bin
uses: actions/cache/store@v4
with:
path: ${{ env.BAZELISK_BIN_DIR }}
key: ${{ env.BAZELISK_VERSION }}-bazelisk-bin
- name: Install bazelisk if it's needed
if: steps.cache-bazelisk-bin.outputs.cache-hit != 'true'
run: |
wget https://github.com/bazelbuild/bazelisk/releases/download/${{ env.BAZELISK_VERSION }} \
-O "${{ env.BAZELISK_BIN_DIR }}/bazelisk"
chmod +x "${{ env.BAZELISK_BIN_DIR }}/bazelisk"
- name: Save bazelisk binary
uses: actions/cache/save@v4
if: steps.cache-bazelisk-bin.outputs.cache-hit != 'true'
with:
path: ${{ env.BAZELISK_BIN_DIR }}
key: ${{ env.BAZELISK_VERSION }}-bazelisk-bin
- name: Add bazelisk to PATH
run: echo "${{ env.BAZELISK_BIN_DIR }}" >> "${GITHUB_PATH}"
- name: Run unit tests
run: ./execute_tests.bash
- name: Save build cache
uses: actions/cache/save@v4
with:
path: .cache
key: ${{ runner.os }}-build