Skip to content

Commit

Permalink
improve cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottSuarez committed Oct 30, 2023
1 parent 348839d commit 8b3c19f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test-tgc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ jobs:
with:
repository: ${{ github.event.inputs.owner }}/${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.branch }}
path: tgc
path: repo
fetch-depth: 2
- name: Cache Go modules and build cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('**/go.sum', 'google-beta/transport/**', 'google-beta/tpgresource/**', 'google-beta/acctest/**', 'google-beta/envvar/**', 'google-beta/sweeper/**', 'google-beta/verify/**') }}
key: ${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('repo/go.sum', 'repo/google-beta/transport/**', 'repo/google-beta/tpgresource/**', 'repo/google-beta/acctest/**', 'repo/google-beta/envvar/**', 'repo/google-beta/sweeper/**', 'repo/google-beta/verify/**') }}
restore-keys: |
${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('**/go.sum') }}
${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('repo/go.sum') }}
${{ runner.os }}-test-${{ github.event.inputs.repo }}-
- name: Check for Code Changes
id: pull_request
run: |
cd tgc
cd repo
gofiles=$(git diff --name-only HEAD~1 | { grep -e "\.go$" -e "go.mod$" -e "go.sum$" || test $? = 1; })
if [ -z "$gofiles" ]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -88,14 +88,14 @@ jobs:
- name: Build Terraform Google Conversion
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd tgc
cd repo
go mod edit -replace github.com/hashicorp/terraform-provider-google-beta=github.com/${{ github.event.inputs.owner }}/terraform-provider-google-beta@${{ github.event.inputs.branch }}
go mod tidy
make build
- name: Run Unit Tests
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd tgc
cd repo
make test
- name: Post Result Status to Pull Request
if: ${{ !cancelled() }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test-tpg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ jobs:
with:
repository: ${{ github.event.inputs.owner }}/${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.branch }}
path: provider
path: repo
fetch-depth: 2
- name: Cache Go modules and build cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('**/go.sum', 'google-beta/transport/**', 'google-beta/tpgresource/**', 'google-beta/acctest/**', 'google-beta/envvar/**', 'google-beta/sweeper/**', 'google-beta/verify/**') }}
key: ${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('repo/go.sum', 'repo/google-beta/transport/**', 'repo/google-beta/tpgresource/**', 'repo/google-beta/acctest/**', 'repo/google-beta/envvar/**', 'repo/google-beta/sweeper/**', 'repo/google-beta/verify/**') }}
restore-keys: |
${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('**/go.sum') }}
${{ runner.os }}-test-${{ github.event.inputs.repo }}-${{ hashFiles('repo/go.sum') }}
${{ runner.os }}-test-${{ github.event.inputs.repo }}-
- name: Check for Code Changes
id: pull_request
run: |
cd provider
cd repo
gofiles=$(git diff --name-only HEAD~1 | { grep -e "\.go$" -e "go.mod$" -e "go.sum$" || test $? = 1; })
if [ -z "$gofiles" ]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -88,22 +88,22 @@ jobs:
- name: Build Provider
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd provider
cd repo
go build
- name: Run Unit Tests
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd provider
cd repo
make testnolint
- name: Lint Check
if: ${{ !cancelled() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd provider
cd repo
make lint
- name: Documentation Check
if: ${{ !cancelled() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd provider
cd repo
make docscheck
- name: Post Result Status to Pull Request
if: ${{ !cancelled() }}
Expand Down

0 comments on commit 8b3c19f

Please sign in to comment.