Skip to content

Merge pull request #178 from WillAbides/goup #755

Merge pull request #178 from WillAbides/goup

Merge pull request #178 from WillAbides/goup #755

Workflow file for this run

name: ci
on:
push:
branches: [ 'main' ]
pull_request:
types: [ synchronize, opened, reopened, labeled, unlabeled ]
jobs:
matrix_test:
strategy:
matrix:
platform:
- ubuntu-22.04
- macos-13
- windows-2022
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.21.x'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-test-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-test
- run: script/test
shell: sh
test:
needs:
- matrix_test
runs-on: ubuntu-22.04
steps:
- run: echo ok
shell: sh
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.21.x'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
.bindown
key: ${{ runner.os }}-go-lint-${{ hashFiles('**/go.sum', 'bindown.yml', 'script/*') }}
restore-keys: ${{ runner.os }}-go-lint
- run: script/lint
- run: script/deadcode
generate:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.21.x'
- name: configure git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-generate-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-generate
- run: script/generate --check
release:
runs-on: ubuntu-22.04
needs:
- test
- lint
- generate
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.21.x'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-release-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-release
- uses: WillAbides/[email protected]
id: release-train
with:
create-release: true
release-refs: main
pre-tag-hook: |
set -e
script/check-module-version "$(go list -m)" "$RELEASE_TAG"
script/bindown install goreleaser
git tag "$RELEASE_TAG"
bin/goreleaser release --clean --skip-publish
cp dist/checksums.txt dist/bindown_*.tar.gz "$ASSETS_DIR"
- if: steps.release-train.outputs.created-release == 'true'
env:
RELEASE_TAG: ${{ steps.release-train.outputs.release-tag }}
GH_TOKEN: ${{ github.token }}
run: |
script/bindown -q install gh
go run ./internal/build-bootstrapper -tag "$RELEASE_TAG" > bootstrap-bindown.sh
bin/gh release upload "$RELEASE_TAG" bootstrap-bindown.sh