Skip to content

Commit

Permalink
Use GitHub action for Jacoco coverage summary
Browse files Browse the repository at this point in the history
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
  • Loading branch information
bestbeforetoday committed Aug 15, 2024
1 parent 1e03b8b commit 8fa08e3
Showing 1 changed file with 171 additions and 166 deletions.
337 changes: 171 additions & 166 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,154 +7,154 @@ permissions:
contents: read

jobs:
verify-versions:
uses: ./.github/workflows/verify-versions.yml
# verify-versions:
# uses: ./.github/workflows/verify-versions.yml

docs:
needs: verify-versions
uses: ./.github/workflows/build-docs.yml
# docs:
# needs: verify-versions
# uses: ./.github/workflows/build-docs.yml

shellcheck:
needs: verify-versions
runs-on: ubuntu-latest
name: ShellCheck
steps:
- uses: actions/checkout@v4
- run: make shellcheck
# shellcheck:
# needs: verify-versions
# runs-on: ubuntu-latest
# name: ShellCheck
# steps:
# - uses: actions/checkout@v4
# - run: make shellcheck

go_lint:
needs: verify-versions
runs-on: ubuntu-latest
name: Lint Go
env:
SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Generate mocks
run: make generate
- name: Staticcheck
run: make staticcheck
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
# go_lint:
# needs: verify-versions
# runs-on: ubuntu-latest
# name: Lint Go
# env:
# SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: stable
# - name: Generate mocks
# run: make generate
# - name: Staticcheck
# run: make staticcheck
# - name: golangci-lint
# uses: golangci/golangci-lint-action@v6
# with:
# version: latest

go_unit:
needs: verify-versions
runs-on: ubuntu-22.04
name: Unit test Go
strategy:
fail-fast: false
matrix:
go-version:
- "1.21"
- "1.22"
include:
- go-version: "1.22"
coverage: true
env:
SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install SoftHSM
run: sudo apt install -y softhsm
env:
TMPDIR: ${{ runner.temp }}
- name: Generate mocks
run: make generate
- name: Run unit tests
run: make unit-test-go-pkcs11
- name: Coverage report
if: ${{ matrix.coverage }}
run: |
echo '### Unit test coverage' >> ${GITHUB_STEP_SUMMARY}
go tool cover -func cover.out | tail -1 | sed 's/[^0-9]*/Statement coverage: /' >> ${GITHUB_STEP_SUMMARY}
# go_unit:
# needs: verify-versions
# runs-on: ubuntu-22.04
# name: Unit test Go
# strategy:
# fail-fast: false
# matrix:
# go-version:
# - "1.21"
# - "1.22"
# include:
# - go-version: "1.22"
# coverage: true
# env:
# SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: ${{ matrix.go-version }}
# - name: Install SoftHSM
# run: sudo apt install -y softhsm
# env:
# TMPDIR: ${{ runner.temp }}
# - name: Generate mocks
# run: make generate
# - name: Run unit tests
# run: make unit-test-go-pkcs11
# - name: Coverage report
# if: ${{ matrix.coverage }}
# run: |
# echo '### Unit test coverage' >> ${GITHUB_STEP_SUMMARY}
# go tool cover -func cover.out | tail -1 | sed 's/[^0-9]*/Statement coverage: /' >> ${GITHUB_STEP_SUMMARY}

go_scenario:
needs: verify-versions
runs-on: ubuntu-22.04
name: Scenario test Go
strategy:
fail-fast: false
matrix:
go-version:
- "1.21"
- "1.22"
env:
SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install SoftHSM
run: sudo apt install -y softhsm
env:
TMPDIR: ${{ runner.temp }}
- name: Generate mocks
run: make generate
- name: Pull Fabric Docker images
run: make pull-latest-peer
- name: Run scenario tests
run: make scenario-test-go
# go_scenario:
# needs: verify-versions
# runs-on: ubuntu-22.04
# name: Scenario test Go
# strategy:
# fail-fast: false
# matrix:
# go-version:
# - "1.21"
# - "1.22"
# env:
# SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: ${{ matrix.go-version }}
# - name: Install SoftHSM
# run: sudo apt install -y softhsm
# env:
# TMPDIR: ${{ runner.temp }}
# - name: Generate mocks
# run: make generate
# - name: Pull Fabric Docker images
# run: make pull-latest-peer
# - name: Run scenario tests
# run: make scenario-test-go

node_unit:
needs: verify-versions
runs-on: ubuntu-22.04
name: Unit test Node
strategy:
fail-fast: false
matrix:
node-version:
- 18
- 20
env:
SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Run unit tests
run: make unit-test-node
# node_unit:
# needs: verify-versions
# runs-on: ubuntu-22.04
# name: Unit test Node
# strategy:
# fail-fast: false
# matrix:
# node-version:
# - 18
# - 20
# env:
# SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# - name: Run unit tests
# run: make unit-test-node

node_scenario:
needs: verify-versions
runs-on: ubuntu-22.04
name: Scenario test Node
strategy:
fail-fast: false
matrix:
node-version:
- 18
- 20
env:
SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Install SoftHSM
run: sudo apt install -y softhsm
env:
TMPDIR: ${{ runner.temp }}
- name: Pull Fabric Docker images
run: make pull-latest-peer
- name: Run scenario tests
run: make scenario-test-node
# node_scenario:
# needs: verify-versions
# runs-on: ubuntu-22.04
# name: Scenario test Node
# strategy:
# fail-fast: false
# matrix:
# node-version:
# - 18
# - 20
# env:
# SOFTHSM2_CONF: ${{ github.workspace }}/softhsm2.conf
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# - uses: actions/setup-go@v5
# with:
# go-version: stable
# - name: Install SoftHSM
# run: sudo apt install -y softhsm
# env:
# TMPDIR: ${{ runner.temp }}
# - name: Pull Fabric Docker images
# run: make pull-latest-peer
# - name: Run scenario tests
# run: make scenario-test-node

java_unit:
needs: verify-versions
# needs: verify-versions
runs-on: ubuntu-22.04
name: Unit test Java
strategy:
Expand All @@ -176,33 +176,38 @@ jobs:
cache: maven
- name: Run unit tests
run: make unit-test-java
# - name: Coverage report
# if: ${{ matrix.coverage }}
# run: |
# echo '### Unit test coverage' >> ${GITHUB_STEP_SUMMARY}
# ${{ github.workspace }}/.github/scripts/jacoco2markdown.sh java/target/site/jacoco/jacoco.csv >> ${GITHUB_STEP_SUMMARY}
- name: Coverage report
if: ${{ matrix.coverage }}
run: |
echo '### Unit test coverage' >> ${GITHUB_STEP_SUMMARY}
${{ github.workspace }}/.github/scripts/jacoco2markdown.sh java/target/site/jacoco/jacoco.csv >> ${GITHUB_STEP_SUMMARY}
java_scenario:
needs: verify-versions
runs-on: ubuntu-22.04
name: Scenario test Java
strategy:
fail-fast: false
matrix:
java-version:
- 11
- 21
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
uses: bestbeforetoday/jacoco-summary-action@main
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
cache: maven
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Pull Fabric Docker images
run: make pull-latest-peer
- name: Run scenario tests
run: make scenario-test-java
coverage-file: java/target/site/jacoco/jacoco.csv

# java_scenario:
# needs: verify-versions
# runs-on: ubuntu-22.04
# name: Scenario test Java
# strategy:
# fail-fast: false
# matrix:
# java-version:
# - 11
# - 21
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-java@v4
# with:
# java-version: ${{ matrix.java-version }}
# distribution: temurin
# cache: maven
# - uses: actions/setup-go@v5
# with:
# go-version: stable
# - name: Pull Fabric Docker images
# run: make pull-latest-peer
# - name: Run scenario tests
# run: make scenario-test-java

0 comments on commit 8fa08e3

Please sign in to comment.