Cleanup #129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |