Skip to content

Commit e38a9ef

Browse files
committed
use Go 1.22 only Unix-like OSes builds
1 parent 10cd478 commit e38a9ef

File tree

2 files changed

+67
-28
lines changed

2 files changed

+67
-28
lines changed

.github/workflows/go-build.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build(Go)
2+
run-name: Build (${{ inputs.os-version }}/${{ inputs.go-version }})
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
os-version:
8+
description: 'GitHub-hosted runnners'
9+
default: ubuntu-22.04
10+
required: false
11+
type: string
12+
run:
13+
description: 'The commands to run in bash'
14+
default: go build
15+
required: false
16+
type: string
17+
upload-artifact-path:
18+
description: >
19+
A file, directory or wildcard pattern that describes what to upload.
20+
If empty, the workflow will upload no artifacts.
21+
default: ''
22+
required: false
23+
type: string
24+
upload-artifact-name:
25+
description: 'Artifact name'
26+
default: artifact
27+
required: false
28+
type: string
29+
30+
env:
31+
DEBIAN_FRONTEND: noninteractive
32+
jobs:
33+
run:
34+
runs-on: ${{ inputs.os-version }}
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-go@v5
38+
with:
39+
go-version: 1.22.x
40+
cache: true
41+
check-latest: true
42+
43+
- run: ${{ inputs.run }}
44+
shell: bash
45+
46+
- if: inputs.upload-artifact-path != ''
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: ${{ inputs.upload-artifact-name }}
50+
path: ${{ inputs.upload-artifact-path }}

.github/workflows/go.yml

+17-28
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,23 @@ jobs:
2222
os-versions: '["ubuntu-latest", "windows-2022"]'
2323

2424
build-linux:
25-
name: Build (Linux)
26-
runs-on: ubuntu-latest
27-
needs: test
28-
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
29-
env:
30-
DEBIAN_FRONTEND: noninteractive
31-
steps:
32-
# before-deploy
33-
- name: Set up Go 1.x
34-
uses: actions/setup-go@v5
35-
with:
36-
go-version: 1.20.x
37-
- name: Check out code into the Go module directory
38-
uses: actions/checkout@v4
39-
- name: Install debian packaging utils, binutils
40-
run: sudo apt-get update && sudo apt-get install -y devscripts debhelper fakeroot binutils-mips-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf
41-
- run: docker pull mackerel/docker-mackerel-rpm-builder:c7
42-
- run: make rpm deb rpm-kcps deb-kcps rpm-stage deb-stage tgz
43-
- run: make crossbuild
44-
- uses: actions/upload-artifact@v3
45-
with:
46-
name: linux-build-artifacts
47-
path: |
48-
rpmbuild/RPMS/*/*.rpm
49-
packaging/*.deb
50-
snapshot/*.zip
51-
snapshot/*.tar.gz
52-
build/*.tar.gz
25+
name: Build (Unix-like OSes)
26+
uses: ./.github/workflows/go-build.yml
27+
with:
28+
os-version: ubuntu-latest
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y devscripts debhelper fakeroot binutils-mips-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf
32+
docker pull mackerel/docker-mackerel-rpm-builder:c7
33+
make rpm deb rpm-kcps deb-kcps rpm-stage deb-stage tgz
34+
make crossbuild
35+
upload-artifact-name: linux-build-artifacts
36+
upload-artifact-path: |
37+
rpmbuild/RPMS/*/*.rpm
38+
packaging/*.deb
39+
snapshot/*.zip
40+
snapshot/*.tar.gz
41+
build/*.tar.gz
5342
5443
# Note:
5544
# Mackerel-agent requires cgo for using Windows native API.

0 commit comments

Comments
 (0)