forked from yaling888/quirktiva
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 1.08 KB
/
test.yml
File metadata and controls
34 lines (29 loc) · 1.08 KB
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
name: Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Get latest go version
id: version
run: |
go_mod_version=$(cat go.mod | grep -oE '^go [0-9]{1,}.[0-9|a-z]{1,}(.[0-9]{1,})?' | awk '(NR==1){printf $2}' | sed 's/beta/.0-beta./' | sed 's/rc/.0-rc./')
latest_go_version=$(curl -sSL https://go.dev/dl/?mode=json | grep "version" | cut -d\" -f4 | awk -Fgo '(NR==1){printf $2}') || ""
go_version="$latest_go_version"
if [[ -z "$latest_go_version" ]] || [[ $go_mod_version =~ .*[rc|beta].* ]]; then
go_version="$go_mod_version"
fi
echo "go_version=${go_version}" >> $GITHUB_OUTPUT
echo "go version go${go_version}"
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ steps.version.outputs.go_version }}
check-latest: true
cache: false
- name: TestAll
if: contains(github.event.head_commit.message, 'test')
run: |
cd test/
make test