Skip to content

Commit b6aedd3

Browse files
committed
ci: add build and lint workflows
1 parent ebd92c0 commit b6aedd3

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

.github/workflows/build-release.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
tags:
7+
- v*
8+
9+
jobs:
10+
prepare-release:
11+
name: Prepare release
12+
runs-on: ubuntu-latest
13+
if: github.event_name == 'push'
14+
steps:
15+
- run: |-
16+
gh release create "${{ github.ref_name }}" \
17+
--target "${{ github.sha }}"
18+
19+
build:
20+
name: Build
21+
runs-on: ubuntu-latest
22+
needs: [ prepare-release ]
23+
strategy:
24+
matrix:
25+
goos: [ linux ]
26+
goarch: [ amd64, arm64 ]
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Extract k6 version from go.mod
30+
id: version
31+
run: |-
32+
k6version=$(grep -e go.k6.io go.mod | cut -d' ' -f 2)
33+
echo "Detected k6 version: ${k6version}"
34+
echo "k6=${k6version}" >> $GITHUB_OUTPUT
35+
- name: Build with xk6
36+
run: |-
37+
docker run --rm -i -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" \
38+
-e "GOOS=${{ matrix.goos }}" -e "GOARCH=${{ matrix.goarch }}" \
39+
grafana/xk6 build ${{ steps.version.outputs.k6 }} \
40+
--output "dist/sm-k6-${{ matrix.goos }}-${{ matrix.goarch }}" \
41+
--with sm=.
42+
- name: Upload artifact to release
43+
if: github.event_name == 'push'
44+
run: |-
45+
gh release upload "${{ github.ref_name }}" dist/*

.github/workflows/lint.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lint
2+
3+
on:
4+
pull_request: {}
5+
6+
jobs:
7+
golangci:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: golangci-lint
13+
uses: golangci/golangci-lint-action@v6
14+
with:
15+
only-new-issues: true
16+
args: --timeout=5m # 1m is not enough, experimentally.

0 commit comments

Comments
 (0)