Skip to content

Commit

Permalink
ci: add build and lint workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
roobre committed Aug 23, 2024
1 parent ebd92c0 commit 3dcebec
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build

on:
pull_request: {}
push:
tags:
- v*

jobs:
prepare-release:
name: Prepare release
runs-on: ubuntu-latest
steps:
- if: github.event_name == 'push'
run: |-
gh release create "${{ github.ref_name }}" \
--target "${{ github.sha }}"
build:
name: Build
runs-on: ubuntu-latest
needs: [ prepare-release ]
strategy:
matrix:
goos: [ linux ]
goarch: [ amd64, arm64 ]
steps:
- uses: actions/checkout@v4
- name: Extract k6 version from go.mod
id: version
run: |-
k6version=$(grep -e go.k6.io go.mod | cut -d' ' -f 2)
echo "Detected k6 version: ${k6version}"
echo "k6=${k6version}" >> $GITHUB_OUTPUT
- name: Build with xk6
run: |-
docker run --rm -i -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" \
-e "GOOS=${{ matrix.goos }}" -e "GOARCH=${{ matrix.goarch }}" \
grafana/xk6 build ${{ steps.version.outputs.k6 }} \
--output "dist/sm-k6-${{ matrix.goos }}-${{ matrix.goarch }}" \
--with sm=.
- name: Upload artifact to release
if: github.event_name == 'push'
run: |-
gh release upload "${{ github.ref_name }}" dist/*
16 changes: 16 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint

on:
pull_request: {}

jobs:
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
only-new-issues: true
args: --timeout=5m # 1m is not enough, experimentally.

0 comments on commit 3dcebec

Please sign in to comment.