Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions .github/workflows/automation-integration-test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Integration test build

on:
workflow_call:
inputs:
test-source-path:
description: 'Path to the Go test suite directory'
required: true
type: string
repository:
description: 'Repository to checkout (defaults to calling repo)'
required: false
type: string
default: ''
ref:
description: 'Git ref to checkout. Accepts branch names (master, feature/foo), tags (v1.0.0), full refs (refs/heads/master, refs/tags/v1.0.0), or commit SHAs. Defaults to calling ref.'
required: false
type: string
default: ''
artifact-name:
description: 'Name for the uploaded test binary artifact'
required: false
type: string
default: 'integration-test-binary'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || github.ref }}

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: ${{ inputs.test-source-path }}/go.mod
cache-dependency-path: ${{ inputs.test-source-path }}/go.sum
Comment thread
avnes marked this conversation as resolved.

- name: Build test binary
working-directory: ${{ inputs.test-source-path }}
run: go test -c -v -vet=off -o /tmp/test.bin

- name: Upload test binary
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: /tmp/test.bin
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Shared workflows and actions:
- [Enforce PR labels](#enforce-pr-labels)
- [Golang test suite](#golang-test-suite)
- [Housekeeping](#housekeeping)
- [Integration test build](#integration-test-build)
- [Multi architecture docker build](#multi-architecture-docker-build)
- [Block on-hold PRs](#block-on-hold-prs)
- [Add comment from PR template on Renovate pull requests](#add-comment-from-pr-template-on-renovate-pull-requests)
Expand Down Expand Up @@ -162,6 +163,32 @@ jobs:
status_checks: true
```

### Integration test build

_This is a workflow_

Builds a Go integration test binary and uploads it as an artifact. Designed for infrastructure integration tests that are compiled once and run against multiple environments.

How to invoke this workflow:

```yaml
name: Integration test build

on:
push:
branches: [master]

jobs:
build-test:
uses: dfds/shared-workflows/.github/workflows/automation-integration-test-build.yml@master
with:
test-source-path: test/integration/suite
repository: dfds/infrastructure-modules
ref: master
artifact-name: test-binary

```

### Multi architecture docker build

_This is a workflow_
Expand Down
15 changes: 15 additions & 0 deletions examples/automation-integration-test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Integration test build
description: Builds a Go integration test binary and uploads it as an artifact. Designed for infrastructure integration tests that are compiled once and run against multiple environments.

on:
push:
branches: [master]

jobs:
build-test:
uses: dfds/shared-workflows/.github/workflows/automation-integration-test-build.yml@master
with:
test-source-path: test/integration/suite
repository: dfds/infrastructure-modules
ref: master
artifact-name: test-binary