-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Steffen Vogel <[email protected]>
- Loading branch information
Showing
2 changed files
with
101 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# SPDX-FileCopyrightText: 2023 Steffen Vogel <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json | ||
--- | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, macOS-latest, windows-latest ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt-get install -y | ||
libpcsclite-dev | ||
pcscd | ||
pcsc-tools | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
check-latest: true | ||
|
||
- name: Lint | ||
# TODO: golangci-lint v1.54 is currently broken on Windows? | ||
if: matrix.os != 'windows-latest' | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.54.0 | ||
continue-on-error: true | ||
|
||
- name: Set up gotestfmt | ||
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest | ||
|
||
- name: Run Go tests | ||
if: matrix.os == 'ubuntu-latest' | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
go test \ | ||
-v \ | ||
-json \ | ||
-coverpkg ./... \ | ||
-tags ci \ | ||
-coverprofile cover.profile \ | ||
./... 2>&1 | \ | ||
tee gotest.log | \ | ||
gotestfmt | ||
- name: Upload test log | ||
if: always() && matrix.os == 'ubuntu-latest' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-log | ||
path: gotest.log | ||
if-no-files-found: error | ||
|
||
- name: Build | ||
if: matrix.os != 'ubuntu-latest' | ||
run: go build . | ||
|
||
- name: Report test coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: cover.profile |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
|
||
# SPDX-FileCopyrightText: 2023 Steffen Vogel <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json | ||
--- | ||
name: Build | ||
name: Test with virtual cards | ||
|
||
on: | ||
push: | ||
|
@@ -12,46 +13,43 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, macOS-latest, windows-latest ] | ||
test: | ||
name: Test with Virtual Cards | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt-get install -y | ||
libpcsclite-dev | ||
pcscd | ||
pcsc-tools | ||
|
||
- name: Start card | ||
run: docker run | ||
--detach | ||
--volume /run/pcscd:/run/pcscd | ||
registry.gitlab.com/hkos/virtual-piv/openfips201 | ||
/bin/bash -c "bash /start.sh; sleep 10000" | ||
|
||
- name: Check virtual card | ||
run: | | ||
sleep 5 | ||
pcsc_scan -vt2 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
check-latest: true | ||
|
||
- name: Lint | ||
# TODO: golangci-lint v1.54 is currently broken on Windows? | ||
if: matrix.os != 'windows-latest' | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.54.0 | ||
continue-on-error: true | ||
|
||
- name: Set up gotestfmt | ||
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest | ||
|
||
- name: Run Go tests | ||
if: matrix.os == 'ubuntu-latest' | ||
shell: bash | ||
env: | ||
TEST_DANGEROUS_WIPE_REAL_CARD: "1" | ||
run: | | ||
set -euo pipefail | ||
go test \ | ||
|
@@ -71,12 +69,3 @@ jobs: | |
name: test-log | ||
path: gotest.log | ||
if-no-files-found: error | ||
|
||
- name: Build | ||
if: matrix.os != 'ubuntu-latest' | ||
run: go build . | ||
|
||
- name: Report test coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: cover.profile |