Archive repo notification #78
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: QA | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
env: | |
GO_VERSION: "1.19" | |
jobs: | |
lint: | |
name: Lint Code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# https://github.com/actions/checkout/issues/1169 | |
- name: Workaround Git Security Warning | |
run: | | |
# Workaround a bug in github actions: | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "${{ env.GO_VERSION }}" | |
# don't cache dependencies, we want to always lint with the latest version | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
build: | |
name: Build Test | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# https://github.com/actions/checkout/issues/1169 | |
- name: Workaround Git Security Warning | |
run: | | |
# Workaround a bug in github actions: | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "${{ env.GO_VERSION }}" | |
cache: true | |
cache-dependency-path: go.sum | |
- name: Build | |
run: | | |
go build -a -o dogechain -ldflags="\ | |
-X 'github.com/dogechain-lab/dogechain/versioning.Version=${GITHUB_REF_NAME}' \ | |
-X 'github.com/dogechain-lab/dogechain/versioning.Commit=${GITHUB_COMMIT_HASH}' \ | |
-X 'github.com/dogechain-lab/dogechain/versioning.BuildTime=${GITHUB_BUILT_AT}' \ | |
-extldflags '"-Wl,-z,stack-size=0x800000" "-static"' "\ | |
-tags 'osusergo netgo static_build' && tar -czvf dogechain.tar.gz dogechain | |
env: | |
CGO_ENABLED: 0 | |
CC: gcc | |
CXX: g++ | |
GOARC: amd64 | |
GOOS: linux | |
GITHUB_COMMIT_HASH: ${{ github.sha }} | |
GITHUB_BUILT_AT: ${{ github.event.head_commit.timestamp }} | |
tests: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# https://github.com/actions/checkout/issues/1169 | |
- name: Workaround Git Security Warning | |
run: | | |
# Workaround a bug in github actions: | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "${{ env.GO_VERSION }}" | |
cache: true | |
cache-dependency-path: go.sum | |
- name: Run Go Test | |
run: go test -coverprofile coverage.out -timeout 20m `go list ./... | grep -v e2e` | |
- name: Upload coverage file to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.out | |
e2e-tests: | |
name: Run e2e tests | |
runs-on: ubuntu-latest | |
needs: | |
- tests | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# https://github.com/actions/checkout/issues/1169 | |
- name: Workaround Git Security Warning | |
run: | | |
# Workaround a bug in github actions: | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "${{ env.GO_VERSION }}" | |
cache: true | |
cache-dependency-path: go.sum | |
- name: Run tests | |
run: make test-e2e |