This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
71 lines (63 loc) · 2.14 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
---
name: Cleanup
on:
schedule:
# run every Saturday
- cron: "0 12 * * 6"
jobs:
clean:
name: Clean stale packages and caches
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
go-version:
- 1.18.x
os: [ubuntu-latest]
may-fail: [false]
include:
- go-version: tip
os: ubuntu-latest
may-fail: true
continue-on-error: ${{ matrix.may-fail }}
runs-on: ${{ matrix.os }}
env:
GOFLAGS: -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'
uses: percona-platform/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Go tip
if: matrix.go-version == 'tip'
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: percona-platform/checkout@v3
- name: Enable Go modules cache
uses: percona-platform/cache@v2
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: percona-platform/cache@v2
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