Skip to content

Commit

Permalink
enable tpm tests on windows (#42)
Browse files Browse the repository at this point in the history
sets cgo flags to include needed openssl files before linting and testing so that tpm tests can run on all platforms
  • Loading branch information
James-Pickett authored Jun 7, 2024
1 parent d638d29 commit 4b09646
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: install actionlint
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,21 @@ jobs:
with:
go-version: ${{ matrix.go }}
cache: true
- name: Install OpenSSL on Windows
- name: set windows cgo flags
if: runner.os == 'Windows'
# this is required to be able to run the TPM simulator on Windows
# https://github.com/google/go-tpm-tools#openssl-errors-when-building-simulator
run: choco install openssl
shell: bash
run: |
echo "CGO_CFLAGS=-IC:\mingw64\opt\include" >> "$GITHUB_ENV"
echo "CGO_LDFLAGS=-LC:\mingw64\opt\lib" >> "$GITHUB_ENV"
- name: set macos cgo flags
if: runner.os == 'macos'
run: |
echo CGO_CFLAGS="-I$(brew --prefix openssl)/include" >> "$GITHUB_ENV"
echo CGO_LDFLAGS="-L$(brew --prefix openssl)/lib" >> "$GITHUB_ENV"
- name: Lint
uses: golangci/golangci-lint-action@v3
- name: Test
run: go test $(go list ./... | grep -v cross_language_tests) -race
run: go test $(go list ./... | grep -v cross_language_tests) -race -cover
shell: bash

cross:
Expand All @@ -90,12 +95,6 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install OpenSSL on Windows
if: runner.os == 'Windows'
# this is required to be able to run the TPM simulator on Windows
# https://github.com/google/go-tpm-tools#openssl-errors-when-building-simulator
run: choco install openssl
shell: bash
- name: Install Libsodium on Windows
if: runner.os == 'Windows'
# this is a dependency of the ruby rbnacl library
Expand Down
3 changes: 0 additions & 3 deletions pkg/tpm/tpm_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !windows
// +build !windows

package tpm

import (
Expand Down

0 comments on commit 4b09646

Please sign in to comment.