feat(exomint): introduce module #441
Workflow file for this run
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 workflow runs on every push and pull request to the repository. | |
# It then calculates the unit test coverage and checks if it's above a certain threshold. | |
# this information is passed on to another workflow as artifacts for commenting on the PR. | |
# This is because the `pull_request` event does not have the commenting permissions. | |
# We could switch to `pull_request_target` which does have them, however, it | |
# opens a security hole. See: | |
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
name: Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
- main | |
- master | |
- release/** | |
permissions: | |
# for uploading artifacts | |
contents: write | |
pull-requests: read | |
# Automatically cancel run if another commit to the same ref is detected. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test-unit-cover: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
check-latest: true | |
- uses: actions/checkout@v4 | |
- uses: technote-space/[email protected] | |
with: | |
PATTERNS: | | |
**/**.go | |
go.mod | |
go.sum | |
- name: Test and create coverage report | |
run: | | |
make test-unit-cover | |
if: env.GIT_DIFF | |
- name: Check if test coverage is above threshold | |
id: output-coverage | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
profile: cover.out | |
local-prefix: github.com/ExocoreNetwork/exocore | |
# TODO: increase this threshold with time to 80 | |
threshold-total: 0 | |
if: env.GIT_DIFF | |
# even if coverage is low, do not exit. | |
continue-on-error: true | |
- name: Generate artifact for PR | |
run: | | |
mkdir -p ./result/ | |
echo "${{ steps.output-coverage.outputs.total-coverage }}" > ./result/coverage.txt | |
echo "${{ github.event.pull_request.number }}" > ./result/pr_number.txt | |
if: env.GIT_DIFF && github.event_name == 'pull_request' | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: result | |
path: ./result/ | |
if: env.GIT_DIFF && github.event_name == 'pull_request' |