Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to GHA #379

Merged
merged 26 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
48342dd
remove circle config directory
claire-labry Sep 20, 2022
592a7c8
migrate go-getter to GHA
claire-labry Sep 20, 2022
3079b2a
disable aws tests
claire-labry Sep 20, 2022
4cd1421
add env var
claire-labry Sep 21, 2022
7b76199
Setup AWS OIDC for go-getter tests
dpowley Sep 26, 2022
61e02f1
Change AWS OIDC audience
dpowley Sep 26, 2022
c596b42
Update test s3 bucket name
dpowley Sep 26, 2022
3e428c4
Enable keyless GCP testing
dpowley Sep 26, 2022
d57df6e
Bump GCP libraries for WIF
dpowley Sep 26, 2022
b6335dc
Add audience specification in GHA workflow
dpowley Sep 26, 2022
b279273
Remove old versions from GHA testing
dpowley Sep 26, 2022
98db99c
Update GCS object versions
dpowley Sep 26, 2022
e7c9a3a
Update file contents and version pointers
dpowley Sep 27, 2022
9063526
update how we install gotestsum
claire-labry Sep 27, 2022
d305097
fix setup cache action
claire-labry Sep 27, 2022
0f1552a
adding pr feedback
claire-labry Sep 27, 2022
936fda0
Update GCP WIF provider resource id
dpowley Sep 28, 2022
6b06366
Update .github/workflows/go-getter.yml
claire-labry Oct 3, 2022
a1abc4b
move go mod after cache for linux
claire-labry Oct 3, 2022
d2f3d7b
Merge branch 'main' into migrate-to-gha
claire-labry Oct 25, 2022
d5725c7
go mod tidy
claire-labry Oct 25, 2022
bad826d
fix git getter
claire-labry Oct 25, 2022
cc303a6
remove init from s3 file
claire-labry Oct 26, 2022
47ecbb0
add comments on how to test gcs and s3
claire-labry Oct 26, 2022
95c5f2d
Update get_s3_test.go
claire-labry Oct 26, 2022
2daac52
Update get_gcs_test.go
claire-labry Oct 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 0 additions & 176 deletions .circleci/config.yml

This file was deleted.

158 changes: 158 additions & 0 deletions .github/workflows/go-getter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: go-getter

on: [push]

env:
TEST_RESULTS_PATH: /tmp/test-results

jobs:

linux-tests:
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- 1.17
- 1.18
- 1.19
permissions:
id-token: write
contents: read
steps:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v3

- name: Create test directory
run: |
mkdir -p ${{ env.TEST_RESULTS_PATH }}

- name: Setup cache for go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download go modules
run: go mod download

# Check go fmt output because it does not report non-zero when there are fmt changes
- name: Run gofmt
run: |
go fmt ./...
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi

- name: Install gotestsum
run: go install gotest.tools/gotestsum@v1.8.2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::388664967494:role/hc-go-getter-test
role-session-name: ${{ github.run_id }}
audience: https://github.com/hashicorp

- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0.4.0'
with:
workload_identity_provider: 'projects/328212837253/locations/global/workloadIdentityPools/hc-go-getter-test/providers/github-hc-go-getter-test'
service_account: hc-go-getter-test@hc-e56c0f7c21c448d2be9e7696073.iam.gserviceaccount.com
audience: https://github.com/hashicorp

- name: Run go tests
run: |
PACKAGE_NAMES=$(go list ./...)
echo "Running $(echo $PACKAGE_NAMES | wc -w) packages"
echo $PACKAGE_NAMES
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_PATH/go-getter/gotestsum-report.xml -- -p 2 -cover -coverprofile=linux_cov.part $PACKAGE_NAMES

# Save coverage report parts
- name: Upload and save artifacts
uses: actions/upload-artifact@v3
with:
name: linux test results
path: linux_cov.part

windows-tests:
runs-on: windows-latest
strategy:
matrix:
go-version:
- 1.17
- 1.18
- 1.19
permissions:
id-token: write
contents: read
steps:
- name: Run git config #Windows-only
run: git config --global core.autocrlf false

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v3

- name: Setup cache for go modules
uses: actions/cache@v3
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download go modules
run: go mod download

- name: Install gotestsum
shell: bash
run: go install gotest.tools/gotestsum@v1.8.2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::388664967494:role/hc-go-getter-test
role-session-name: ${{ github.run_id }}
audience: https://github.com/hashicorp

- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0.4.0'
with:
workload_identity_provider: 'projects/328212837253/locations/global/workloadIdentityPools/hc-go-getter-test/providers/github-hc-go-getter-test'
service_account: hc-go-getter-test@hc-e56c0f7c21c448d2be9e7696073.iam.gserviceaccount.com
audience: https://github.com/hashicorp

- name: Run go tests
shell: bash
run: |
PACKAGE_NAMES=$(go list ./...)
echo "Running $(echo $PACKAGE_NAMES | wc -w) packages"
echo $PACKAGE_NAMES
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_PATH/go-getter/gotestsum-report.xml -- -p 2 -cover -race -coverprofile=win_cov.part $PACKAGE_NAMES

# Save coverage report parts
- name: Upload and save artifacts
uses: actions/upload-artifact@v3
with:
name: windows test results
path: win_cov.part
Loading