-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Github Actions for release and goreleaser-cross (#28)
* Use Github Actions for release and goreleaser-cross
- Loading branch information
Showing
7 changed files
with
170 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
name: Create Release | ||
steps: | ||
- name: Set version | ||
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- uses: creekorful/goreportcard-action@v1.0 | ||
- name: setup release environment | ||
run: |- | ||
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env | ||
- name: Run GoReleaser | ||
run: make release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Test | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Run tests | ||
run: make | ||
- name: Run coverage | ||
run: make coverage | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.txt | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Run GoReleaser build | ||
run: make release-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
/.tarballs | ||
/.build | ||
/ondemand_exporter | ||
/coverage.txt | ||
/dist | ||
/.release-env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod download | ||
env: | ||
- CGO_ENABLED=1 | ||
builds: | ||
- id: amd64 | ||
main: ondemand_exporter.go | ||
env: | ||
- CC=x86_64-linux-gnu-gcc | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
ldflags: | ||
- -extldflags "-static" | ||
- -X github.com/prometheus/common/version.Version={{.Version}} | ||
- -X github.com/prometheus/common/version.Revision={{.FullCommit}} | ||
- -X github.com/prometheus/common/version.Branch={{.Branch}} | ||
- -X github.com/prometheus/common/version.BuildUser=goreleaser | ||
- -X github.com/prometheus/common/version.BuildDate={{.Date}} | ||
- id: arm64 | ||
main: ondemand_exporter.go | ||
env: | ||
- CC=aarch64-linux-gnu-gcc | ||
goos: | ||
- linux | ||
goarch: | ||
- arm64 | ||
ldflags: | ||
- -extldflags "-static" | ||
- -X github.com/prometheus/common/version.Version={{.Version}} | ||
- -X github.com/prometheus/common/version.Revision={{.FullCommit}} | ||
- -X github.com/prometheus/common/version.Branch={{.Branch}} | ||
- -X github.com/prometheus/common/version.BuildUser=goreleaser | ||
- -X github.com/prometheus/common/version.BuildDate={{.Date}} | ||
archives: | ||
- id: archive | ||
builds: | ||
- amd64 | ||
- arm64 | ||
files: | ||
- LICENSE | ||
- CHANGELOG.md | ||
name_template: "ondemand_exporter-{{ .Version }}.{{ .Os }}-{{ .Arch }}" | ||
wrap_in_directory: true | ||
checksum: | ||
name_template: 'checksums.txt' | ||
release: | ||
prerelease: auto | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
# yamllint disable rule:line-length | ||
go: | ||
version: 1.23 | ||
cgo: true | ||
repository: | ||
path: github.com/OSC/ondemand_exporter | ||
path: github.com/OSC/ondemand_exporter | ||
build: | ||
binaries: | ||
- name: ondemand_exporter | ||
path: . | ||
flags: -a -tags netgo | ||
ldflags: | | ||
-extldflags "-static" | ||
-X github.com/prometheus/common/version.Version={{.Version}} | ||
-X github.com/prometheus/common/version.Revision={{.Revision}} | ||
-X github.com/prometheus/common/version.Branch={{.Branch}} | ||
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} | ||
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} | ||
binaries: | ||
- name: ondemand_exporter | ||
path: . | ||
flags: -a -tags netgo | ||
ldflags: | | ||
-extldflags "-static" | ||
-X github.com/prometheus/common/version.Version={{.Version}} | ||
-X github.com/prometheus/common/version.Revision={{.Revision}} | ||
-X github.com/prometheus/common/version.Branch={{.Branch}} | ||
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} | ||
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} | ||
tarball: | ||
files: | ||
- LICENSE | ||
- CHANGELOG.md | ||
- files | ||
files: | ||
- LICENSE | ||
- CHANGELOG.md | ||
- files | ||
crossbuild: | ||
platforms: | ||
- linux/amd64 | ||
- linux/386 | ||
- linux/arm64 | ||
- linux/mips | ||
- linux/mipsle | ||
- linux/mips64 | ||
- linux/mips64le | ||
- linux/ppc64le | ||
platforms: | ||
- linux/amd64 | ||
- linux/386 | ||
- linux/arm64 | ||
- linux/mips | ||
- linux/mipsle | ||
- linux/mips64 | ||
- linux/mips64le | ||
- linux/ppc64le |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters