Merge pull request #166 from Venafi/dependabot/go_modules/github.com/… #269
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
name: CI-Tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['main', 'release-*'] | |
pull_request: | |
permissions: read-all | |
env: | |
GO_VERSION: 1.23.1 | |
jobs: | |
unit-tests: | |
name: Run unit tests | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v3 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- name: Create config.ini | |
uses: DamianReeves/write-file-action@v1.2 | |
with: | |
path: ${{ github.workspace }}/test/config.ini | |
contents: | | |
tpp_url=${{ secrets.TPP_URL }} | |
access_token=${{ secrets.ACCESS_TOKEN }} | |
tpp_project=${{ secrets.TPP_PROJECT }} | |
- name: Create config-ecdsa.ini | |
uses: DamianReeves/write-file-action@v1.2 | |
with: | |
path: ${{ github.workspace }}/test/config-ecdsa.ini | |
contents: | | |
tpp_url=${{ secrets.TPP_URL }} | |
access_token=${{ secrets.ACCESS_TOKEN }} | |
tpp_project=${{ secrets.TPP_ECDSA_PROJECT }} | |
- name: Run Go tests | |
run: go test -covermode atomic -coverprofile ./coverage.txt $(go list ./... | grep -v third_party/) | |
env: | |
TPP_URL: ${{ secrets.TPP_URL }} | |
TPP_USERNAME: ${{ secrets.TPP_USERNAME }} | |
TPP_PASSWORD: ${{ secrets.TPP_PASSWORD }} | |
- name: Upload Coverage Report | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./coverage/reports/ | |
env_vars: OS | |
files: ./coverage.txt | |
verbose: true | |
- name: Run Go tests w/ `-race` | |
if: ${{ runner.os == 'Linux' }} | |
run: go test -race $(go list ./... | grep -v third_party/) | |
env: | |
TPP_URL: ${{ secrets.TPP_URL }} | |
TPP_USERNAME: ${{ secrets.TPP_USERNAME }} | |
TPP_PASSWORD: ${{ secrets.TPP_PASSWORD }} |