Skip to content

Cleanup

Cleanup #71

Workflow file for this run

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.20.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@v4
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@v3
with:
lfs: true
- name: Enable Go modules cache
uses: actions/cache@v3
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@v3
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