chore: detect Go version from go.mod
when building
This commit is contained in:
parent
91ff590b9c
commit
3021ab8896
1 changed files with 16 additions and 18 deletions
|
@ -2,35 +2,33 @@ name: Build and test project
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [master]
|
||||||
- master
|
|
||||||
pull-request:
|
pull-request:
|
||||||
branches:
|
branches: [master]
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: debian-12
|
runs-on: debian-12
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go-version: [ '1.22' ]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
-
|
||||||
- name: Checkout repo
|
name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
- name: Setup Go
|
name: Extract Go version
|
||||||
|
id: go-version
|
||||||
|
run: |
|
||||||
|
sed '/^go /!d; s/go /version=/' go.mod >>"$GITHUB_OUTPUT"
|
||||||
|
-
|
||||||
|
name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go-version }}
|
go-version: ${{ steps.go-version.outputs.version }}
|
||||||
|
-
|
||||||
- name: Build for host architecture
|
name: Build for host architecture
|
||||||
run: |
|
run: |
|
||||||
make build
|
make build
|
||||||
|
-
|
||||||
- name: Run tests
|
name: Run tests
|
||||||
run: |
|
run: |
|
||||||
make test
|
make test
|
||||||
|
|
Loading…
Reference in a new issue