Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Edjroz/enhancement/test coverage releases #164

Merged
merged 10 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ on:
branches: [ main ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
**/**.go
go.mod
go.sum

- name: Set up Go
uses: actions/setup-go@v2
Expand All @@ -24,3 +29,23 @@ jobs:
- name: Test
run: go test -v ./...

- name: test & coverage report creation
run: |
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock'
if: "env.GIT_DIFF != ''"
- name: filter out DONTCOVER
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
excludelist+=" $(find ./ -type f -name '*.pb.go')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^./github.com\/archway-network\/archwayd/g')
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: "env.GIT_DIFF != ''"
- uses: codecov/codecov-action@v1
with:
file: ./coverage.txt # optional
fail_ci_if_error: true
if: "env.GIT_DIFF != ''"

36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
release:
types: [published]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
db_backend: [ goleveldb ]
env: # Or as an environment variable
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- uses: actions/setup-go@v2
with:
go-version: "^1.17" # The Go version to download (if necessary) and use.
aelesbao marked this conversation as resolved.
Show resolved Hide resolved
- name: Build
run: |
VERSION=${{ steps.get_version.outputs.VERSION }} DB_BACKEND=${{ matrix.db_backend }} LINK_STATICALLY=true make build
tar -czvf archwayd_${{ steps.get_version.outputs.VERSION }}_${{ matrix.os }}.tar.gz build/archwayd
- uses: actions/upload-artifact@v2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actions/upload-artifact@v2 action is to upload artifacts to workflow runs so that the next step can download them. To add assets to a GitHub release, you should use an action that interacts with the Releases API.

with:
name: archwayd_${{ steps.get_version.outputs.VERSION }}_${{ matrix.os }}.tar.gz
path: archwayd_${{ steps.get_version.outputs.VERSION }}_${{ matrix.os }}.tar.gz
- name: Release
- uses: softprops/action-gh-release@v1
with:
files: archwayd_${{ steps.get_version.outputs.VERSION }}_${{ matrix.os }}.tar.gz

1 change: 1 addition & 0 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// DONTCOVER
package app

import (
Expand Down