-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c7ab01
commit 0a322c4
Showing
3 changed files
with
81 additions
and
53 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: "PR: Run all tests" | ||
|
||
# When will this pipeline be activated? | ||
# 1. On any pull-request, or if someone pushes to a branch called | ||
# "tlim_testpr". | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
# Want to trigger all the tests without making a PR? | ||
# Run: git push origin main:tlim_testpr --force | ||
# This will trigger a full PR test on the main branch. | ||
# See https://github.com/StackExchange/dnscontrol/actions/workflows/pr_test.yml?query=branch%3Atlim_testpr | ||
push: | ||
branches: | ||
- 'tlim_testpr' | ||
|
||
# Environment Variables | ||
env: | ||
# cache-key: Change to force cache reset `pwsh > Get-Date -UFormat %s` | ||
cache-key: 1639697695 | ||
# go-mod-path: Where go-mod writes temp files | ||
go-mod-path: /go/pkg/mod | ||
# BIND_DOMAIN: BIND is the one providers that we always test. By | ||
# defining this here, we know it will always be set. | ||
BIND_DOMAIN: example.com | ||
|
||
jobs: | ||
|
||
# build: Use GoReleasere to build binaries for all platforms. | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
TEST_RESULTS: "/tmp/test-results" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
- name: restore_cache | ||
uses: actions/[email protected] | ||
with: | ||
key: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} | ||
restore-keys: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} | ||
path: ${{ env.go-mod-path }} | ||
- run: mkdir -p "$TEST_RESULTS" | ||
- name: Run unit tests | ||
run: | | ||
go install gotest.tools/gotestsum@latest | ||
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES | ||
- name: Enforce Go Formatted Code | ||
run: "[ `go fmt ./... | wc -l` -eq 0 ]" | ||
- uses: actions/[email protected] | ||
with: | ||
name: unit-tests | ||
path: ${{ env.TEST_RESULTS }} | ||
|
||
# Stringer is needed because .goreleaser includes "go generate ./..." | ||
- name: Install stringer | ||
run: | | ||
go install golang.org/x/tools/cmd/stringer@latest | ||
- | ||
id: build_binaries_tagged | ||
name: Build binaries (if tagged) | ||
if: github.ref_type == 'tag' | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: build | ||
- | ||
id: build_binaries_not_tagged | ||
name: Build binaries (not tagged) | ||
if: github.ref_type != 'tag' | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
args: build --snapshot |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,59 +26,6 @@ env: | |
|
||
jobs: | ||
|
||
# build: Use GoReleasere to build binaries for all platforms. | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
TEST_RESULTS: "/tmp/test-results" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
- name: restore_cache | ||
uses: actions/[email protected] | ||
with: | ||
key: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} | ||
restore-keys: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} | ||
path: ${{ env.go-mod-path }} | ||
- run: mkdir -p "$TEST_RESULTS" | ||
- name: Run unit tests | ||
run: | | ||
go install gotest.tools/gotestsum@latest | ||
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES | ||
- name: Enforce Go Formatted Code | ||
run: "[ `go fmt ./... | wc -l` -eq 0 ]" | ||
- uses: actions/[email protected] | ||
with: | ||
name: unit-tests | ||
path: ${{ env.TEST_RESULTS }} | ||
|
||
# Stringer is needed because .goreleaser includes "go generate ./..." | ||
- name: Install stringer | ||
run: | | ||
go install golang.org/x/tools/cmd/stringer@latest | ||
- | ||
id: build_binaries_tagged | ||
name: Build binaries (if tagged) | ||
if: github.ref_type == 'tag' | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: build | ||
- | ||
id: build_binaries_not_tagged | ||
name: Build binaries (not tagged) | ||
if: github.ref_type != 'tag' | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
args: build --snapshot | ||
|
||
# integration-test-providers: Determine which providers have a _DOMAIN variable set. | ||
# That variable enables testing for the provider. The results are | ||
# stored in a JSON blob stashed in # needs.integration-test-providers.outputs.integration_test_providers | ||
|
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