-
Notifications
You must be signed in to change notification settings - Fork 128
78 lines (69 loc) · 2.36 KB
/
clean.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Cleanup
on:
schedule:
# run every Saturday
- cron: "0 12 * * 6"
jobs:
clean:
name: Clean caches
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
go:
- version: 1.22.x
may-fail: false
- version: tip
may-fail: true
continue-on-error: ${{ matrix.go.may-fail }}
runs-on: ubuntu-22.04
env:
GOFLAGS: -v -mod=readonly
GOPRIVATE: github.com/percona-platform
steps:
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Set up Go release
if: matrix.go.version != 'tip'
env:
# to avoid error due to `go version` accepting -v flag with an argument since 1.15
GOFLAGS: ""
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go.version }}
- name: Set up Go tip
if: matrix.go.version == 'tip'
env:
# to avoid error due to `go version` accepting -v flag with an argument since 1.15
GOFLAGS: ""
run: |
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "$HOME/gotip/bin" >> $GITHUB_PATH
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: true
- name: Enable Go modules cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go.version }}-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go.version }}-modules-
- name: Enable Go build cache
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go.version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go.version }}-build-${{ github.ref }}-
${{ matrix.os }}-go-${{ matrix.go.version }}-build-
- name: Clean Go modules cache
run: go clean -modcache
- name: Clean Go build cache
run: go clean -cache