-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
11 changed files
with
206 additions
and
364 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,19 @@ | ||
name: Build and Test | ||
description: Runs build | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x | ||
cache-dependency-path: ./*.sum | ||
- name: Run build | ||
shell: bash | ||
run: make build | ||
- name: Check worktree clean | ||
uses: pulumi/git-status-check-action@v1 | ||
- name: Run unit tests | ||
shell: bash | ||
run: make test |
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,60 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
folder: | ||
type: string | ||
required: true | ||
description: The folder in which to run tests | ||
|
||
env: | ||
AWS_REGION: us-west-2 | ||
|
||
jobs: | ||
acceptance-tests: | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{ inputs.folder }}-test-${{ github.sha }}-${{ matrix.index }} | ||
cancel-in-progress: false | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
role-duration-seconds: 3600 | ||
role-session-name: pulumi-tool-cdk-importer@githubActions | ||
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }} | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
registry-url: https://registry.npmjs.org | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x | ||
cache-dependency-path: ./*.sum | ||
- name: Install Yarn | ||
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0 | ||
- name: Run build | ||
run: make build | ||
- name: Install gotestsum | ||
run: go install gotest.tools/gotestsum@latest | ||
- name: Generate go test Slice | ||
id: test_split | ||
uses: hashicorp-forge/[email protected] | ||
with: | ||
working-directory: ${{ inputs.folder }} | ||
total: ${{ matrix.parallel }} | ||
index: ${{ matrix.index }} | ||
- name: Run ${{ inputs.folder }} tests | ||
# run: cd ${{ inputs.folder }} && gotestsum --format github-actions -- -v -count=1 -timeout 2h -parallel 4 -run "${{ steps.test_split.outputs.run }}" | ||
run: cd ${{ inputs.folder }} && go test -v -count=1 -timeout 1h -parallel 4 -run "${{ steps.test_split.outputs.run }}" ./... | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
parallel: [3] | ||
index: [0, 1, 2] |
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,47 @@ | ||
env: | ||
AWS_REGION: us-west-2 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | ||
PULUMI_API: https://api.pulumi-staging.io | ||
jobs: | ||
build: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
- name: build | ||
uses: ./.github/actions/build | ||
|
||
integration-test: | ||
name: integration-test | ||
secrets: inherit | ||
uses: ./.github/workflows/acceptance-tests.yml | ||
with: | ||
folder: integration | ||
|
||
sentinel: | ||
runs-on: ubuntu-latest | ||
name: sentinel | ||
steps: | ||
- name: Mark workflow as successful | ||
uses: guibranco/github-status-action-v2@0849440ec82c5fa69b2377725b9b7852a3977e76 | ||
with: | ||
authToken: ${{ secrets.GITHUB_TOKEN }} | ||
context: Sentinel | ||
state: success | ||
description: Sentinel checks passed | ||
sha: ${{ github.event.pull_request.head.sha || github.sha }} | ||
if: github.event_name == 'repository_dispatch' || | ||
github.event.pull_request.head.repo.full_name == github.repository | ||
needs: | ||
- build | ||
- integration-test | ||
|
||
name: Run Acceptance Tests from PR | ||
on: | ||
repository_dispatch: | ||
types: [run-acceptance-tests-command] | ||
pull_request: | ||
branches: | ||
- main |
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 |
---|---|---|
|
@@ -27,3 +27,4 @@ pulumi-tool-cdk-importer | |
cover.cov | ||
integration/**/node_modules/ | ||
bin | ||
coverage.txt |
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 |
---|---|---|
|
@@ -6,3 +6,6 @@ build: | |
|
||
generate: | ||
go generate ./... | ||
|
||
test: | ||
go test -v -short -coverpkg=./... -coverprofile=coverage.txt ./... |
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
Oops, something went wrong.