-
Notifications
You must be signed in to change notification settings - Fork 3
55 lines (53 loc) · 1.43 KB
/
build-onyx.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
name: Test onyx pipeline
on:
workflow_dispatch:
push:
branches:
- "test-onyx-caching"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ">=1.20.0"
cache: true
- name: Setup Golang caches
id: go-cache
uses: actions/cache@v3
with:
path: |
onyx/bin
key: ${{ runner.os }}-golang-${{ hashFiles('onyx/bin') }}
restore-keys: |
${{ runner.os }}-golang-
- name: Check if folder has changed
id: check-changes
run: |
diff_output=$(git diff HEAD HEAD~1 -- onyx/)
# Check if the output is empty
if [ -n "$diff_output" ]; then
echo "There are changes."
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "No changes detected."
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Show cache contents
run: |
ls -ltr onyx
- if: ${{ steps.check-changes.outputs.changed == 'true' || steps.go-cache.outputs.cache-hit != 'true'}}
name: Build
working-directory: onyx
run: |
make setup
make build