Skip to content

Commit

Permalink
Add actions.preTest (#524)
Browse files Browse the repository at this point in the history
* Add actions.preTest to insert arbitrary actions before tests

This customization hook is currently only used by docker to set up digital ocean keys. It
will be used by aws when aws adopts ci-mgmt workflows for `Configure AWS Credentials`.

* Switch docker over to using `actions.preTest`

This provides a consistent pre-test environment between the various files that define
tests:
- main.yml
- master.yml
- prerelease.yml
- release.yml
- run-acceptance-tests.yml
  • Loading branch information
iwahbe authored Aug 24, 2023
1 parent a4fd201 commit bf076b4
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,9 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
#{{- if .Config.digitalOceanSshKey }}#
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY_FOR_DIGITALOCEAN }}
#{{- end }}#
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
7 changes: 6 additions & 1 deletion provider-ci/providers/docker/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ major-version: 4
aws: true
gcp: true
gcpRegistry: true
digitalOceanSshKey: true
env:
AWS_REGION: us-west-2
ARM_CLIENT_ID: "30e520fa-12b4-4e21-b473-9426c5ac2e1e"
Expand All @@ -28,3 +27,9 @@ plugins:
- name: aws
version: "5.37.0"
team: ecosystem
actions:
preTest:
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY_FOR_DIGITALOCEAN }}
4 changes: 4 additions & 0 deletions provider-ci/providers/docker/repo/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY_FOR_DIGITALOCEAN }}
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY_FOR_DIGITALOCEAN }}
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY_FOR_DIGITALOCEAN }}
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.4.0
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY_FOR_DIGITALOCEAN }}
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down

0 comments on commit bf076b4

Please sign in to comment.