Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Go 1.22 only Unix-like OSes builds #983

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/go-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build(Go)
run-name: Build (${{ inputs.os-version }}/${{ inputs.go-version }})

on:
workflow_call:
inputs:
os-version:
description: 'GitHub-hosted runnners'
default: ubuntu-22.04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want the default value to be well without maintenance than parameters passed from outside, I want it to be stable. I think ubuntu-latest is more stable than ubuntu-22.04.

required: false
type: string
run:
description: 'The commands to run in bash'
default: go build
required: false
type: string
upload-artifact-path:
description: >
A file, directory or wildcard pattern that describes what to upload.
If empty, the workflow will upload no artifacts.
default: ''
required: false
type: string
upload-artifact-name:
description: 'Artifact name'
default: artifact
required: false
type: string

env:
DEBIAN_FRONTEND: noninteractive
jobs:
run:
runs-on: ${{ inputs.os-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache: true
check-latest: true

- run: ${{ inputs.run }}
shell: bash

- if: inputs.upload-artifact-path != ''
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.upload-artifact-name }}
path: ${{ inputs.upload-artifact-path }}
45 changes: 17 additions & 28 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,23 @@ jobs:
os-versions: '["ubuntu-latest", "windows-2022"]'

build-linux:
name: Build (Linux)
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
env:
DEBIAN_FRONTEND: noninteractive
steps:
# before-deploy
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: 1.20.x
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install debian packaging utils, binutils
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
- run: docker pull mackerel/docker-mackerel-rpm-builder:c7
- run: make rpm deb rpm-kcps deb-kcps rpm-stage deb-stage tgz
- run: make crossbuild
- uses: actions/upload-artifact@v3
with:
name: linux-build-artifacts
path: |
rpmbuild/RPMS/*/*.rpm
packaging/*.deb
snapshot/*.zip
snapshot/*.tar.gz
build/*.tar.gz
name: Build (Unix-like OSes)
uses: ./.github/workflows/go-build.yml
with:
os-version: ubuntu-latest
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
docker pull mackerel/docker-mackerel-rpm-builder:c7
make rpm deb rpm-kcps deb-kcps rpm-stage deb-stage tgz
make crossbuild
upload-artifact-name: linux-build-artifacts
upload-artifact-path: |
rpmbuild/RPMS/*/*.rpm
packaging/*.deb
snapshot/*.zip
snapshot/*.tar.gz
build/*.tar.gz

# Note:
# Mackerel-agent requires cgo for using Windows native API.
Expand Down
Loading