Skip to content

Commit 90b07b1

Browse files
Migrate MA/MR pipeline from CircleCI to GH Actions (#12579)
1 parent 92aa776 commit 90b07b1

File tree

2 files changed

+99
-6
lines changed

2 files changed

+99
-6
lines changed

.github/workflows/aws-tests-mamr.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: AWS / MA/MR tests
2+
3+
on:
4+
schedule:
5+
- cron: 0 1 * * MON-FRI
6+
pull_request:
7+
paths:
8+
- '.github/workflows/aws-tests-mamr.yml'
9+
- '.github/workflows/aws-tests.yml'
10+
workflow_dispatch:
11+
inputs:
12+
disableCaching:
13+
description: 'Disable Caching'
14+
required: false
15+
type: boolean
16+
default: false
17+
PYTEST_LOGLEVEL:
18+
type: choice
19+
description: Loglevel for PyTest
20+
options:
21+
- DEBUG
22+
- INFO
23+
- WARNING
24+
- ERROR
25+
- CRITICAL
26+
default: WARNING
27+
28+
env:
29+
IMAGE_NAME: "localstack/localstack"
30+
TINYBIRD_DATASOURCE: "community_tests_circleci_ma_mr"
31+
32+
jobs:
33+
generate-random-creds:
34+
name: "Generate random AWS credentials"
35+
runs-on: ubuntu-latest
36+
outputs:
37+
region: ${{ steps.generate-aws-values.outputs.region }}
38+
account_id: ${{ steps.generate-aws-values.outputs.account_id }}
39+
steps:
40+
- name: Generate values
41+
id: generate-aws-values
42+
run: |
43+
# Generate a random 12-digit number for TEST_AWS_ACCOUNT_ID
44+
ACCOUNT_ID=$(shuf -i 100000000000-999999999999 -n 1)
45+
echo "account_id=$ACCOUNT_ID" >> $GITHUB_OUTPUT
46+
# Set TEST_AWS_REGION_NAME to a random AWS region other than us-east-1
47+
REGIONS=("us-east-2" "us-west-1" "us-west-2" "ap-southeast-2" "ap-northeast-1" "eu-central-1" "eu-west-1")
48+
REGION=${REGIONS[RANDOM % ${#REGIONS[@]}]}
49+
echo "region=$REGION" >> $GITHUB_OUTPUT
50+
51+
test-ma-mr:
52+
name: "Run integration tests"
53+
needs: generate-random-creds
54+
uses: ./.github/workflows/aws-tests.yml
55+
with:
56+
disableCaching: ${{ inputs.disableCaching == true }}
57+
PYTEST_LOGLEVEL: ${{ inputs.PYTEST_LOGLEVEL }}
58+
testAWSRegion: ${{ needs.generate-random-creds.outputs.region }}
59+
testAWSAccountId: ${{ needs.generate-random-creds.outputs.account_id }}
60+
testAWSAccessKeyId: ${{ needs.generate-random-creds.outputs.account_id }}

.github/workflows/aws-tests.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ on:
3333
default: false
3434
required: false
3535
type: boolean
36+
testAWSRegion:
37+
description: 'AWS test region'
38+
required: false
39+
type: string
40+
default: 'us-east-1'
41+
testAWSAccountId:
42+
description: 'AWS test account ID'
43+
required: false
44+
type: string
45+
default: '000000000000'
46+
testAWSAccessKeyId:
47+
description: 'AWS test access key ID'
48+
required: false
49+
type: string
50+
default: 'test'
3651
workflow_call:
3752
inputs:
3853
disableCaching:
@@ -60,12 +75,30 @@ on:
6075
default: false
6176
required: false
6277
type: boolean
78+
testAWSRegion:
79+
description: 'AWS test region'
80+
required: false
81+
type: string
82+
default: 'us-east-1'
83+
testAWSAccountId:
84+
description: 'AWS test account ID'
85+
required: false
86+
type: string
87+
default: '000000000000'
88+
testAWSAccessKeyId:
89+
description: 'AWS test access key ID'
90+
required: false
91+
type: string
92+
default: 'test'
6393

6494
env:
6595
PYTEST_LOGLEVEL: ${{ inputs.PYTEST_LOGLEVEL || 'WARNING' }}
6696
IMAGE_NAME: "localstack/localstack"
6797
TINYBIRD_DATASOURCE: "community_tests_integration"
6898
TESTSELECTION_PYTEST_ARGS: "${{ !inputs.disableTestSelection && '--path-filter=dist/testselection/test-selection.txt ' || '' }}"
99+
TEST_AWS_REGION_NAME: ${{ inputs.testAWSRegion }}
100+
TEST_AWS_ACCOUNT_ID: ${{ inputs.testAWSAccountId }}
101+
TEST_AWS_ACCESS_KEY_ID: ${{ inputs.testAWSAccessKeyId }}
69102

70103
jobs:
71104
build:
@@ -139,7 +172,7 @@ jobs:
139172
fetch-depth: 0
140173

141174
- name: Prepare Local Test Environment
142-
uses: localstack/localstack/.github/actions/setup-test-env@master
175+
uses: localstack/localstack/.github/actions/setup-tests-env@master
143176

144177
- name: Linting
145178
run: make lint
@@ -316,7 +349,7 @@ jobs:
316349
fetch-depth: 0
317350

318351
- name: Prepare Local Test Environment
319-
uses: localstack/localstack/.github/actions/setup-test-env@master
352+
uses: localstack/localstack/.github/actions/setup-tests-env@master
320353

321354
- name: Load Localstack Docker Image
322355
uses: localstack/localstack/.github/actions/load-localstack-docker-from-artifacts@master
@@ -437,7 +470,7 @@ jobs:
437470
uses: actions/checkout@v4
438471

439472
- name: Prepare Local Test Environment
440-
uses: localstack/localstack/.github/actions/setup-test-env@master
473+
uses: localstack/localstack/.github/actions/setup-tests-env@master
441474

442475
- name: Run Cloudwatch v1 Provider Tests
443476
timeout-minutes: 30
@@ -480,7 +513,7 @@ jobs:
480513
uses: actions/checkout@v4
481514

482515
- name: Prepare Local Test Environment
483-
uses: localstack/localstack/.github/actions/setup-test-env@master
516+
uses: localstack/localstack/.github/actions/setup-tests-env@master
484517

485518
- name: Download Test Selection
486519
if: ${{ env.TESTSELECTION_PYTEST_ARGS }}
@@ -529,7 +562,7 @@ jobs:
529562
uses: actions/checkout@v4
530563

531564
- name: Prepare Local Test Environment
532-
uses: localstack/localstack/.github/actions/setup-test-env@master
565+
uses: localstack/localstack/.github/actions/setup-tests-env@master
533566

534567
- name: Download Test Selection
535568
if: ${{ env.TESTSELECTION_PYTEST_ARGS }}
@@ -580,7 +613,7 @@ jobs:
580613
uses: actions/checkout@v4
581614

582615
- name: Prepare Local Test Environment
583-
uses: localstack/localstack/.github/actions/setup-test-env@master
616+
uses: localstack/localstack/.github/actions/setup-tests-env@master
584617

585618
- name: Download Test Selection
586619
if: ${{ env.TESTSELECTION_PYTEST_ARGS }}

0 commit comments

Comments
 (0)