|
1 |
| -name: "PR: Run all tests" |
| 1 | +name: "PR: Run integration tests" |
| 2 | + |
| 3 | +# When will this pipeline be activated? |
| 4 | +# 1. On any pull-request, or if someone pushes to a branch called |
| 5 | +# "tlim_testpr". |
2 | 6 | on:
|
3 |
| - # git push origin main:tlim_testpr --force |
4 |
| - # will trigger a full PR test on the main branch: |
5 |
| - # https://github.com/StackExchange/dnscontrol/actions/workflows/pr_test.yml?query=branch%3Atlim_testpr |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + # Want to trigger all the tests without making a PR? |
| 10 | + # Run: git push origin main:tlim_testpr --force |
| 11 | + # This will trigger a full PR test on the main branch. |
| 12 | + # See https://github.com/StackExchange/dnscontrol/actions/workflows/pr_test.yml?query=branch%3Atlim_testpr |
6 | 13 | push:
|
7 | 14 | branches:
|
8 | 15 | - 'tlim_testpr'
|
9 |
| - pull_request: |
10 |
| - workflow_dispatch: |
11 | 16 |
|
| 17 | +# Environment Variables |
12 | 18 | env:
|
13 |
| - cache-key: 1639697695 #Change to force cache reset `pwsh > Get-Date -UFormat %s` |
| 19 | + # cache-key: Change to force cache reset `pwsh > Get-Date -UFormat %s` |
| 20 | + cache-key: 1639697695 |
| 21 | + # go-mod-path: Where go-mod writes temp files |
14 | 22 | go-mod-path: /go/pkg/mod
|
| 23 | + # BIND_DOMAIN: BIND is the one providers that we always test. By |
| 24 | + # defining this here, we know it will always be set. |
15 | 25 | BIND_DOMAIN: example.com
|
16 | 26 |
|
17 | 27 | jobs:
|
18 |
| - build: |
19 |
| - runs-on: ubuntu-latest |
20 |
| - env: |
21 |
| - TEST_RESULTS: "/tmp/test-results" |
22 |
| - steps: |
23 |
| - - uses: actions/checkout@v4 |
24 |
| - with: |
25 |
| - fetch-depth: 0 |
26 |
| - - name: Set up Go |
27 |
| - uses: actions/setup-go@v5 |
28 |
| - with: |
29 |
| - go-version: stable |
30 |
| - - name: restore_cache |
31 |
| - |
32 |
| - with: |
33 |
| - key: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} |
34 |
| - restore-keys: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} |
35 |
| - path: ${{ env.go-mod-path }} |
36 |
| - - run: mkdir -p "$TEST_RESULTS" |
37 |
| - - name: Run unit tests |
38 |
| - run: | |
39 |
| - go install gotest.tools/gotestsum@latest |
40 |
| - gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES |
41 |
| - - name: Enforce Go Formatted Code |
42 |
| - run: "[ `go fmt ./... | wc -l` -eq 0 ]" |
43 |
| - |
44 |
| - with: |
45 |
| - name: unit-tests |
46 |
| - path: ${{ env.TEST_RESULTS }} |
47 |
| - |
48 |
| -# Stringer is needed because .goreleaser includes "go generate ./..." |
49 |
| - - name: Install stringer |
50 |
| - run: | |
51 |
| - go install golang.org/x/tools/cmd/stringer@latest |
52 | 28 |
|
53 |
| - - |
54 |
| - id: build_binaries_tagged |
55 |
| - name: Build binaries (if tagged) |
56 |
| - if: github.ref_type == 'tag' |
57 |
| - uses: goreleaser/goreleaser-action@v6 |
58 |
| - with: |
59 |
| - distribution: goreleaser |
60 |
| - version: latest |
61 |
| - args: build |
62 |
| - - |
63 |
| - id: build_binaries_not_tagged |
64 |
| - name: Build binaries (not tagged) |
65 |
| - if: github.ref_type != 'tag' |
66 |
| - uses: goreleaser/goreleaser-action@v6 |
67 |
| - with: |
68 |
| - args: build --snapshot |
| 29 | +# integration-test-providers: Determine which providers have a _DOMAIN variable set. |
| 30 | +# That variable enables testing for the provider. The results are |
| 31 | +# stored in a JSON blob stashed in # needs.integration-test-providers.outputs.integration_test_providers |
| 32 | +# where integration-tests can pick it up. |
69 | 33 | integration-test-providers:
|
70 |
| - needs: build |
| 34 | + #needs: build |
71 | 35 | runs-on: ubuntu-latest
|
72 | 36 | outputs:
|
73 | 37 | integration_test_providers: ${{ steps.get_integration_test_providers.outputs.integration_test_providers }}
|
|
92 | 56 | ENV_CONTEXT: ${{ toJson(env) }}
|
93 | 57 | VARS_CONTEXT: ${{ toJson(vars) }}
|
94 | 58 | SECRETS_CONTEXT: ${{ toJson(secrets) }}
|
| 59 | + |
| 60 | +# integration-tests: Run the integration tests on any provider listed |
| 61 | +# in needs.integration-test-providers.outputs.integration_test_providers. |
95 | 62 | integration-tests:
|
96 | 63 | if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main'
|
97 | 64 | runs-on: ubuntu-latest
|
@@ -150,7 +117,7 @@ jobs:
|
150 | 117 | CNR_UID: ${{ secrets.CNR_UID }}
|
151 | 118 | CNR_PW: ${{ secrets.CNR_PW }}
|
152 | 119 | CNR_ENTITY: ${{ secrets.CNR_ENTITY }}
|
153 |
| - # |
| 120 | + # |
154 | 121 | DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
155 | 122 | #
|
156 | 123 | GANDI_V5_APIKEY: ${{ secrets.GANDI_V5_APIKEY }}
|
|
0 commit comments