40 lines
1011 B
YAML
40 lines
1011 B
YAML
name: run go test
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '**/*.go'
|
|
- go.mod
|
|
- go.lock
|
|
- go.work
|
|
- .gitea/workflows/go-test.yaml
|
|
env:
|
|
GOPROXY: ${{ vars.GOPROXY }}
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: docker
|
|
steps:
|
|
- name: Setup apt mirror
|
|
run: sed -i "s,deb.debian.org,${{ vars.DEBIAN_MIRROR }},g" ${{ vars.DEBIAN_APT_SOURCES }}
|
|
if: ${{ vars.DEBIAN_MIRROR && vars.DEBIAN_APT_SOURCES }}
|
|
- name: Setup Debian environment
|
|
run: apt update && apt install -y nodejs
|
|
- name: Setup cache for golang toolchain
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
/opt/hostedtoolcache/go
|
|
/root/go/pkg/mod
|
|
/root/.cache/go-build
|
|
key: ${{ runner.os }}-golang
|
|
- name: Setup Golang
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.24.0
|
|
cache-dependency-path: |
|
|
go.sum
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Run tests
|
|
run: go test -v ./... |