Fix caching #5
Workflow file for this run
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: Go Test π | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: πΉ Build & Test with Go ${{ matrix.go-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: | |
- 1.20.x | |
- 1.21.x | |
- 1.22.x | |
- 1.23.x | |
steps: | |
- name: π Checkout Repository | |
uses: actions/checkout@v4 | |
- name: π οΈ Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: πΎ Cache Go Modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ matrix.go-version }}- | |
${{ runner.os }}-go- | |
${{ runner.os }}- | |
- name: π¦ Install Dependencies | |
run: go mod download | |
- name: π Set CLOUDINARY_URL | |
run: | | |
export CLOUDINARY_URL=$(bash scripts/get_test_cloud.sh) | |
echo "CLOUDINARY_URL=$CLOUDINARY_URL" >> $GITHUB_ENV | |
echo "cloud_name: $(echo $CLOUDINARY_URL | cut -d'@' -f2)" | |
- name: π§° Install gotestsum | |
run: go install gotest.tools/gotestsum@latest | |
- name: π§ͺ Run Tests with gotestsum | |
run: | | |
gotestsum --junitfile unit-tests.xml --format pkgname ./... | |
- name: π Display Test Summary | |
uses: test-summary/action@v2 | |
with: | |
paths: "unit-tests.xml" | |
if: always() |