“commit” #50
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
# This is a basic workflow that is manually triggered | |
name: build and test | |
# Controls when the action will run. Workflow runs when manually triggered using the UI | |
# or API. | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: | |
- "develop" | |
- "main" | |
# This workflow makes x86_64 for windows, and linux. | |
jobs: | |
build: | |
strategy: | |
matrix: | |
arch: [amd64] | |
targetos: [linux, windows, darwin] | |
include: | |
- targetos: darwin | |
arch: arm64 | |
runs-on: ubuntu-latest | |
name: build blackfury | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.5" | |
env: | |
GOOS: ${{ matrix.targetos }} | |
GOARCH: ${{ matrix.arch }} | |
- name: Setup Golang caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-golang- | |
- name: Compile blackfury | |
run: | | |
make install | |
- name: Archive blackfury binaries | |
if: github.ref == 'refs/heads/develop' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: blackfuryd-${{ matrix.targetos }}-${{ matrix.arch }} | |
path: | | |
~/go/bin/blackfuryd* | |
test: | |
runs-on: ubuntu-latest | |
name: test blackfury | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.5" | |
env: | |
GOOS: ${{ matrix.targetos }} | |
GOARCH: ${{ matrix.arch }} | |
- name: Setup Golang caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-golang-test-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-golang-test- | |
- name: test blackfury | |
run: | | |
make test-unit-cover | |
- name: filter out DONTCOVER | |
run: | | |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')" | |
excludelist+=" $(find ./ -type f -name '*.pb.go')" | |
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')" | |
excludelist+=" $(find ./ -type f -path './test/*.go')" | |
excludelist+=" $(find ./ -type f -path './osmosis-types/*.go')" | |
for filename in ${excludelist}; do | |
filename=$(echo $filename | sed 's/^./github.com\/nephirim\/blackfury/g') | |
echo "Excluding ${filename} from coverage report..." | |
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt | |
done | |
- name: "Go vulnerability checks" | |
continue-on-error: false #temp-till we upgrade to v1.20 | |
run: make vulncheck | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # needed for private repo | |
files: ./coverage.txt | |
flags: unittests | |
fail_ci_if_error: true | |
verbose: true | |
simulate: | |
if: contains(github.event.pull_request.labels.*.name, 'run-sim') | |
runs-on: ubuntu-latest | |
name: simulate blackfury | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.5" | |
- name: Run simulation tests | |
run: make test-sim-ci |