Skip to content

Commit 8db14e1

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

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

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

.github/workflows/lint.yaml

Lines changed: 16 additions & 0 deletions
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)