-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from mdsol/feature/gha
GitHub actions
- Loading branch information
Showing
5 changed files
with
113 additions
and
13 deletions.
There are no files selected for viewing
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,44 @@ | ||
name: Build Artifact | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- v* | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: [ ubuntu-latest ] | ||
|
||
concurrency: | ||
# Cancel intermediate builds | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: {} | ||
|
||
steps: | ||
- name: CI | ||
uses: ./github/workflows/ci.yaml | ||
|
||
- name: Build | ||
run: make clean lint prepare build pack ß | ||
|
||
- name: Environment | ||
run: | | ||
echo "GOARCH=$(go env GOARCH)" >> $GITHUB_ENV | ||
echo "GOOS=$(go env GOOS)" >> $GITHUB_ENV | ||
echo "BRANCH=$(echo ${{ github.ref_name }} | tr -C '[a-z0-9-\n]' '_')" >> $GITHUB_ENV | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: k6-${{env.GOARCH}}-${{env.GOOS}}-${{ env.BRANCH }}.tar.gz | ||
path: ./bin/*.tar.gz | ||
if-no-files-found: warn | ||
overwrite: true | ||
retention-days: 3 # we need it just for releases | ||
compression-level: 0 # this is already a gzipped archive |
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,42 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
paths: | ||
- .github/workflows/ci.yml | ||
- pkg/** | ||
- go.mod | ||
- go.sum | ||
- Makefile | ||
- register.go | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
verify: | ||
runs-on: [ ubuntu-latest ] | ||
|
||
concurrency: | ||
# Cancel intermediate builds | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: {} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.58.2 | ||
args: --verbose --concurrency=2 --timeout=600s | ||
|
||
- name: Test with the Go CLI | ||
run: go test -v ./... |
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,13 +1,31 @@ | ||
MAKEFLAGS += --silent | ||
GOLANGCI_CONFIG ?= .golangci.yml | ||
GOOS ?= $(shell go env GOOS) | ||
GOARCH ?= $(shell go env GOARCH) | ||
|
||
clean: | ||
rm -f ./bin/k6 | ||
echo Remove old binary if it exists... | ||
rm -f ./bin/* | ||
|
||
build: | ||
echo Build... | ||
xk6 build --output ./bin/k6 --with github.com/mdsol/xk6-output-otlp=. | ||
|
||
pack: | ||
echo Packing... | ||
cd ./bin/; \ | ||
tar -czvf k6-$(GOARCH)-$(GOOS).tar.gz ./k6; \ | ||
rm ./k6 | ||
|
||
format: | ||
echo Format... | ||
go fmt ./... | ||
|
||
.PHONY: build clean format | ||
prepare: | ||
echo Installing XK6... | ||
go install go.k6.io/xk6/cmd/xk6@latest | ||
|
||
lint: | ||
echo Linter... | ||
golangci-lint run | ||
|
||
.PHONY: prepare build clean format lint pack |
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
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