Skip to content

Commit bf9983f

Browse files
author
Bob Strahan
committed
Merge branch 'develop' v0.4.0
2 parents ec8c08c + fd64906 commit bf9983f

File tree

294 files changed

+29948
-23274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+29948
-23274
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: MIT-0
3+
4+
name: Developer Tests
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- "**" # Run on PR open, update, or synchronize (i.e., any push to PR branch)
10+
11+
# Global timeout for all jobs
12+
# Note: GitHub Actions uses minutes, GitLab uses duration strings
13+
jobs:
14+
developer_tests:
15+
name: Lint, Type Check, and Test
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 120 # 2 hours
18+
19+
# Use Python 3.13 to match GitLab configuration
20+
container:
21+
image: python:3.13-bookworm
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0 # Fetch all history for git diff in typecheck-pr
28+
29+
- name: Set up Git safe directory
30+
run: |
31+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
32+
33+
- name: Fetch base branch
34+
run: |
35+
git fetch origin ${{ github.base_ref || 'main' }}:refs/remotes/origin/${{ github.base_ref || 'main' }}
36+
git branch -a
37+
38+
- name: Set up environment
39+
run: |
40+
python --version
41+
apt-get update -y
42+
apt-get install make curl -y
43+
44+
- name: Install uv
45+
run: |
46+
curl -LsSf https://astral.sh/uv/install.sh | sh
47+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
48+
49+
- name: Create virtual environment
50+
run: |
51+
uv venv .venv
52+
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
53+
54+
- name: Install Node.js and basedpyright
55+
run: |
56+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
57+
apt-get install -y nodejs
58+
npm install -g basedpyright
59+
60+
- name: Install Python dependencies
61+
run: |
62+
uv pip install ruff
63+
uv pip install typer rich boto3
64+
cd lib/idp_common_pkg && uv pip install -e ".[test]" && cd ../..
65+
66+
- name: Run linting checks
67+
run: make lint-cicd
68+
69+
- name: Run type checking
70+
run: |
71+
TARGET_BRANCH="${{ github.base_ref }}"
72+
echo "=== Type Checking Configuration ==="
73+
echo "PR target branch (github.base_ref): $TARGET_BRANCH"
74+
echo "Comparing: origin/$TARGET_BRANCH...HEAD"
75+
echo "===================================="
76+
echo ""
77+
78+
make typecheck-pr TARGET_BRANCH="$TARGET_BRANCH"
79+
80+
- name: Run tests
81+
id: run-tests
82+
run: make test-cicd -C lib/idp_common_pkg
83+
continue-on-error: false
84+
85+
- name: Upload coverage reports
86+
uses: actions/upload-artifact@v4
87+
if: always() && steps.run-tests.outcome != 'skipped'
88+
with:
89+
name: test-reports
90+
path: |
91+
lib/idp_common_pkg/test-reports/coverage.xml
92+
lib/idp_common_pkg/test-reports/test-results.xml
93+
retention-days: 7
94+
95+
- name: Publish test results
96+
uses: EnricoMi/publish-unit-test-result-action@v2
97+
if: always() && hashFiles('lib/idp_common_pkg/test-reports/test-results.xml') != ''
98+
with:
99+
files: lib/idp_common_pkg/test-reports/test-results.xml
100+
check_name: Test Results
101+
102+
- name: Code Coverage Report
103+
uses: irongut/[email protected]
104+
if: always() && hashFiles('lib/idp_common_pkg/test-reports/coverage.xml') != ''
105+
with:
106+
filename: lib/idp_common_pkg/test-reports/coverage.xml
107+
badge: true
108+
fail_below_min: false
109+
format: markdown
110+
hide_branch_rate: false
111+
hide_complexity: true
112+
indicators: true
113+
output: both
114+
thresholds: "60 80"
115+
116+
# Note: PR comments disabled for fork PRs due to permission restrictions
117+
# Coverage results are available in:
118+
# 1. Workflow artifacts (test-reports)
119+
# 2. Job summary (automatically generated by CodeCoverageSummary)
120+
# 3. GitHub checks tab

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ notebooks/examples/data
2323
.idea/
2424
.dsr/
2525
*tmp-dev-assets*
26-
scratch/
26+
scratch/
27+
28+
# Node.js / npm
29+
node_modules/
30+
package-lock.json
31+
32+
# Type checking
33+
pyrightconfig.temp.json
34+
.pyright/

.gitlab-ci.yml

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,42 @@ stages:
2626
developer_tests:
2727
stage: developer_tests
2828
rules:
29-
- when: always # Run on all branches
30-
29+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
30+
when: always # Only run on merge requests (PRs), not on merged branches
31+
3132
before_script:
3233
- python --version
3334
- apt-get update -y
34-
- apt-get install make -y
35-
- pip install ruff
35+
- apt-get install make curl git -y
36+
# Fetch target branch for comparison in typecheck-pr
37+
- export TARGET_BRANCH="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}"
38+
- echo "MR target branch (CI_MERGE_REQUEST_TARGET_BRANCH_NAME):$TARGET_BRANCH"
39+
- git fetch origin $TARGET_BRANCH:$TARGET_BRANCH || echo "Could not fetch $TARGET_BRANCH branch"
40+
# Install uv
41+
- pip install uv
42+
# Create virtual environment
43+
- uv venv .venv
44+
- source .venv/bin/activate
45+
# Install Node.js and npm for basedpyright
46+
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
47+
- apt-get install -y nodejs
48+
- npm install -g basedpyright
49+
- uv pip install ruff
3650
# Install dependencies needed by publish.py for test imports
37-
- pip install typer rich boto3
51+
- uv pip install typer rich boto3
3852
# Install test dependencies
39-
- cd lib/idp_common_pkg && pip install -e ".[test]" && cd ../..
53+
- cd lib/idp_common_pkg && uv pip install -e ".[test]" && cd ../..
4054

4155
script:
4256
- make lint-cicd
57+
- echo "=== Type Checking Configuration ==="
58+
- echo "MR target branch:$TARGET_BRANCH"
59+
- echo "Comparing:$TARGET_BRANCH...HEAD"
60+
- echo "===================================="
61+
- echo ""
62+
- make typecheck-pr TARGET_BRANCH=$TARGET_BRANCH
4363
- make test-cicd -C lib/idp_common_pkg
44-
64+
4565
artifacts:
4666
paths:
4767
- lib/idp_common_pkg/test-reports/coverage.xml
@@ -53,6 +73,25 @@ developer_tests:
5373
junit: lib/idp_common_pkg/test-reports/test-results.xml
5474
expire_in: 1 week
5575

76+
deployment_validation:
77+
stage: deployment_validation
78+
rules:
79+
- when: on_success
80+
81+
before_script:
82+
- apt-get update -y
83+
- apt-get install curl unzip python3-pip -y
84+
# Install AWS CLI
85+
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
86+
- unzip awscliv2.zip
87+
- ./aws/install
88+
# Install PyYAML for template analysis
89+
- pip install PyYAML
90+
91+
script:
92+
# Check if service role has sufficient permissions for main stack deployment
93+
- python3 scripts/validate_service_role_permissions.py
94+
5695
integration_tests:
5796
stage: integration_tests
5897
timeout: 2h
@@ -61,9 +100,8 @@ integration_tests:
61100
# AWS_CREDS_TARGET_ROLE: ${AWS_CREDS_TARGET_ROLE}
62101
# AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
63102
# IDP_ACCOUNT_ID: ${IDP_ACCOUNT_ID}
64-
65-
# Add rules to only run on develop branch
66-
# Add rules to only run on develop branch
103+
104+
# Add rules to only run on develop branch
67105
rules:
68106
- if: $CI_COMMIT_BRANCH == "develop"
69107
when: on_success
@@ -78,44 +116,23 @@ integration_tests:
78116
- when: manual
79117

80118
before_script:
81-
- python --version
82119
- apt-get update -y
83-
- apt-get install zip unzip curl make -y
84-
85-
# Install Poetry
86-
- curl -sSL https://install.python-poetry.org | python3 -
87-
- export PATH="/root/.local/bin:$PATH"
88-
- poetry --version
89-
120+
- apt-get install zip unzip curl python3-pip -y
90121
# Install AWS CLI
91122
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
92123
- unzip awscliv2.zip
93124
- ./aws/install
125+
# Install boto3 for Python script
126+
- pip install boto3
94127

95128
script:
96129
- aws --version
97130
- aws sts get-caller-identity --no-cli-pager
98-
- cd ./scripts/sdlc/idp-cli
99-
- poetry install
100-
- make put
101-
- make wait
102-
103-
deployment_validation:
104-
stage: deployment_validation
105-
rules:
106-
- when: on_success
107131

108-
before_script:
109-
- apt-get update -y
110-
- apt-get install curl unzip python3-pip -y
111-
# Install AWS CLI
112-
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
113-
- unzip awscliv2.zip
114-
- ./aws/install
115-
# Install PyYAML for template analysis
116-
- pip install PyYAML
132+
# Set environment variables for Python script
133+
- export IDP_ACCOUNT_ID=${IDP_ACCOUNT_ID:-020432867916}
134+
- export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-east-1}
135+
- export IDP_PIPELINE_NAME=idp-sdlc-deploy-pipeline
117136

118-
script:
119-
# Check if service role has sufficient permissions for main stack deployment
120-
- python3 scripts/validate_service_role_permissions.py
121-
137+
# Run integration test deployment
138+
- python3 scripts/integration_test_deployment.py

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

0 commit comments

Comments
 (0)