mirror of
https://github.com/jimeh/rands.git
synced 2026-02-19 11:26:38 +00:00
140 lines
3.6 KiB
YAML
140 lines
3.6 KiB
YAML
---
|
|
name: CI
|
|
on: [push]
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: v1.64
|
|
env:
|
|
VERBOSE: "true"
|
|
|
|
tidy:
|
|
name: Tidy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: Check if mods are tidy
|
|
run: make check-tidy
|
|
|
|
benchmark:
|
|
name: Benchmarks
|
|
runs-on: ubuntu-latest
|
|
if: github.ref != 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: Run benchmarks
|
|
run: make bench | tee output.raw
|
|
- name: Fix benchmark names
|
|
run: >-
|
|
perl -pe 's/^(Benchmark.+?)\/(\S+)(-\d+)(\s+)/\1__\2\4/' output.raw |
|
|
tr '=-' '_' | tee output.txt
|
|
- name: Announce benchmark result
|
|
uses: rhysd/github-action-benchmark@v1
|
|
with:
|
|
tool: "go"
|
|
output-file-path: output.txt
|
|
fail-on-alert: true
|
|
comment-on-alert: true
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
auto-push: false
|
|
|
|
cov:
|
|
name: Coverage
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: Publish coverage
|
|
uses: paambaati/codeclimate-action@v9
|
|
env:
|
|
VERBOSE: "true"
|
|
GOMAXPROCS: 4
|
|
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
with:
|
|
coverageCommand: make cov
|
|
prefix: github.com/${{ github.repository }}
|
|
coverageLocations: |
|
|
${{ github.workspace }}/coverage.out:gocov
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
go-version:
|
|
- "1.17"
|
|
- "1.18"
|
|
- "1.19"
|
|
- "1.20"
|
|
- "1.21"
|
|
- "1.22"
|
|
- "1.23"
|
|
- "1.24"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Run tests
|
|
run: make test
|
|
env:
|
|
VERBOSE: "true"
|
|
|
|
benchmark-store:
|
|
name: Store benchmarks
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
permissions:
|
|
deployments: write
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: Run benchmarks
|
|
run: make bench | tee output.raw
|
|
- name: Fix benchmark names
|
|
run: >-
|
|
perl -pe 's/^(Benchmark.+?)\/(\S+)(-\d+)(\s+)/\1__\2\4/' output.raw |
|
|
tr '=-' '_' | tee output.txt
|
|
- name: Store benchmark result
|
|
uses: rhysd/github-action-benchmark@v1
|
|
with:
|
|
tool: "go"
|
|
output-file-path: output.txt
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
comment-on-alert: true
|
|
auto-push: true
|
|
|
|
release-please:
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
outputs:
|
|
release_created: ${{ steps.release-please.outputs.release_created }}
|
|
version: ${{ steps.release-please.outputs.version }}
|
|
steps:
|
|
- uses: jimeh/release-please-manifest-action@v2
|
|
id: release-please
|
|
with:
|
|
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
|
|
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
|