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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ typings/

# next.js build output
.next

# Local planning docs
docs/
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,41 @@ slack_always|No|If set, both success and failure notifications will be sent to S
enable_ssh|No|If set, SSH sessions will be created on failure.
ssh_always|No|If set, SSH sessions will always be created, even on success.

## Composite Actions

This repo also contains reusable composite actions for CI/CD pipelines:

### Go
| Action | Description |
|--------|-------------|
| `go/build` | Build Go repo, configure environment, install dependencies |
| `go/test` | Run Go tests with coverage and artifact upload |
| `go/lint` | Run golangci-lint with v1/v2 config auto-detection |
| `go/build-and-test` | Combined build + test with optional `TEST_SETUP_COMMANDS` and `CODE_GEN_COMMANDS` |
| `go/deps` | Install Go dependencies, vendor modules, generate mocks. Supports `CODE_GEN_COMMANDS` for pre-vendor code generation (sqlc, wire, ent) |
| `go/configure` | Configure Go environment (GOPRIVATE, buf, etc.) |
| `go/smoke-test` | Post-deploy smoke tests with optional DataDog Synthetics |

### Ruby
| Action | Description |
|--------|-------------|
| `ruby/deps` | Install Ruby dependencies via Bundler |
| `ruby/lint` | Run RuboCop linter |
| `ruby/test` | Run RSpec tests with artifact upload |
| `ruby/one-for-all` | One-for-all Helm chart validation |
| `ruby/validation/topic` | Kafka topic validation |
| `ruby/validation/schema` | Schema validation |

### Shared
| Action | Description |
|--------|-------------|
| `deploy/eks` | Deploy to EKS (staging/production) with Slack notifications |
| `slack` | Send Slack notifications on job failure/success |
| `cache` | Cache/restore workspace between jobs |
| `common/branch-info` | Extract branch name and short SHA for use in other steps |

Each action's inputs are documented in its `action.yml` file. Use `@v0` to track the latest stable version.

## Contributing

Please make sure to run `npm run prepare` before committing your files! You should probably add this to `.git/hooks/pre-commit`.
Expand Down
31 changes: 31 additions & 0 deletions go/build-and-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ inputs:
description: A timeout value in seconds. If tests take longer than this, they will fail. Not setting this value will fallback to go test's default of 10 minutes.
required: false
default: ""
TEST_SETUP_COMMANDS:
description: Shell commands to run between build and test steps (e.g. DB migrations, seed data, config generation)
required: false
default: ""
PARALLEL:
description: Whether to run tests in parallel. Defaults to true.
required: false
default: "true"
MOCKERY_INSTALL_VERSION:
description: The version of mockery to use
required: false
default: ""
CODE_GEN_COMMANDS:
description: Shell commands to run before go mod tidy (e.g. sqlc generate, wire, ent generate)
required: false
default: ""

runs:
using: "composite"
Expand All @@ -49,6 +65,20 @@ runs:
FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}
BUF_BUILD_USER: ${{ inputs.BUF_BUILD_USER }}
BUF_BUILD_API_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }}
MOCKERY_INSTALL_VERSION: ${{ inputs.MOCKERY_INSTALL_VERSION }}
CODE_GEN_COMMANDS: ${{ inputs.CODE_GEN_COMMANDS }}
- name: Run test setup commands
if: ${{ inputs.TEST_SETUP_COMMANDS != '' }}
shell: bash
run: |
set -e
eval "$TEST_SETUP_COMMANDS"
env:
TEST_SETUP_COMMANDS: ${{ inputs.TEST_SETUP_COMMANDS }}
DB_HOST: ${{ inputs.DB_HOST }}
DB_USER: ${{ inputs.DB_USER }}
DB_PASSWORD: ${{ inputs.DB_PASSWORD }}
DB_PORT: ${{ inputs.DB_PORT }}
- name: Run custom Go test action
uses: wishabi/github-actions/go/test@v0
env:
Expand All @@ -59,6 +89,7 @@ runs:
with:
TAGS: ${{ inputs.TEST_TAGS }}
TIMEOUT: ${{ inputs.TIMEOUT }}
PARALLEL: ${{ inputs.PARALLEL }}
- name: Notify slack channel on failure
if: failure() && inputs.SLACK_CHANNEL_ID != '' && github.ref == 'refs/heads/main'
uses: slackapi/slack-github-action@v1.27.1
Expand Down
10 changes: 10 additions & 0 deletions go/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ inputs:
SLACK_BOT_TOKEN:
description: The Slack bot token to pass the data to
required: false
MOCKERY_INSTALL_VERSION:
description: The version of mockery to use
required: false
default: ""
CODE_GEN_COMMANDS:
description: Shell commands to run before go mod tidy (e.g. sqlc generate, wire, ent generate)
required: false
default: ""

runs:
using: "composite"
Expand All @@ -36,6 +44,8 @@ runs:
BUF_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }}
with:
FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}
MOCKERY_INSTALL_VERSION: ${{ inputs.MOCKERY_INSTALL_VERSION }}
CODE_GEN_COMMANDS: ${{ inputs.CODE_GEN_COMMANDS }}
- name: Write build summary
if: always()
shell: bash
Expand Down
12 changes: 12 additions & 0 deletions go/deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ inputs:
description: The version of mockery to use
required: false
default: ""
CODE_GEN_COMMANDS:
description: Shell commands to run before go mod tidy (e.g. sqlc generate, wire, ent generate)
required: false
default: ""

runs:
using: 'composite'
Expand All @@ -35,6 +39,14 @@ runs:
echo "Go: $(go version)"
if command -v buf &> /dev/null; then echo "Buf: $(buf --version)"; fi
echo "::endgroup::"
- name: Run code generation commands
if: ${{ inputs.CODE_GEN_COMMANDS != '' }}
shell: bash
run: |
set -e
eval "$CODE_GEN_COMMANDS"
env:
CODE_GEN_COMMANDS: ${{ inputs.CODE_GEN_COMMANDS }}
- name: Setting up private modules access
if: steps.vendor-cache.outputs.cache-hit != 'true'
shell: bash
Expand Down
Loading