CI: set up go after code checkout. #10407
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
smoke_tests: | |
required: false | |
type: boolean | |
description: 'Run smoke tests' | |
default: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.event_name != 'workflow_dispatch' }} | |
jobs: | |
golangci: | |
name: lint | |
runs-on: ${{ matrix.os }} | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'wavesplatform/gowaves' | |
strategy: | |
matrix: | |
os: [ macos-latest, windows-latest, ubuntu-latest ] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go 1.22 | |
uses: actions/[email protected] | |
with: | |
go-version: 1.22.x | |
check-latest: true | |
cache: false # don't save & restore build caches because golangci-lint action does it internally | |
- name: Get dependencies | |
run: go mod vendor | |
- name: golangci-lint-soft | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
args: -c .golangci.yml | |
# Strict linter configuration, only checking new code from pull requests. | |
- name: golangci-lint-strict | |
run: golangci-lint run -c .golangci-strict.yml --new-from-rev=origin/master --out-format=colored-line-number | |
build: | |
name: ubuntu | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'wavesplatform/gowaves' | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go 1.22 | |
uses: actions/[email protected] | |
with: | |
go-version: 1.22.x | |
check-latest: true | |
cache: true | |
- name: Set up GolangCI-Lint | |
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $HOME/bin v1.61.0 | |
- name: Get dependencies | |
run: go mod vendor | |
- name: Build and test with race detector | |
run: export PATH="$HOME/bin:$PATH"; make ci | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
if: github.repository == 'wavesplatform/gowaves' # disable for forks | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.txt | |
flags: unittests | |
yml: ./codecov.yml | |
smoke: | |
name: smoke_tests | |
runs-on: self-hosted | |
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' && github.event.inputs.smoke_tests) && | |
github.repository == 'wavesplatform/gowaves'}} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go 1.22 | |
uses: actions/[email protected] | |
with: | |
go-version: 1.22.x | |
check-latest: true | |
cache: true | |
id: go | |
- name: Get dependencies | |
run: go mod vendor | |
- name: Tests | |
run: make smoke | |
- name: Upload smoke tests logs and configs | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: smoke_itest_logs_and_configs | |
path: | | |
build/logs/ | |
build/config/ | |
if-no-files-found: warn | |
retention-days: 5 |