-
Notifications
You must be signed in to change notification settings - Fork 10
44 lines (36 loc) · 1.11 KB
/
test.yml
File metadata and controls
44 lines (36 loc) · 1.11 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
35
36
37
38
39
40
41
42
43
44
name: Test
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout with token
if: github.event_name != 'pull_request'
uses: actions/checkout@v4.2.2
with:
token: ${{ secrets.API_GITHUB_TOKEN }}
- name: Checkout without token
if: github.event_name == 'pull_request'
uses: actions/checkout@v4.2.2
- name: Fetch Go version
run: |
GO_VERSION=$(perl -ne 'print "$1\n" if /FROM golang:([0-9.]+)/' Dockerfile | head -n1)
[ -n "$GO_VERSION" ] || exit 1
echo "go_version=$GO_VERSION" >> $GITHUB_ENV
- name: Setup Go environment
uses: actions/setup-go@v6.1.0
with:
go-version: "${{ env.go_version }}"
- name: Program Test
run: go test ./...
- name: Version
if: github.event_name != 'pull_request'
uses: cycjimmy/semantic-release-action@v6.0.0
with:
semantic_version: 24.2.3
env:
GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}