Skip to content

Commit cff57af

Browse files
author
Kazmer, Nagy-Betegh
committed
turn off developer tests on non PR jobs
1 parent 94717f0 commit cff57af

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

.github/workflows/developer-tests.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,66 @@ name: Developer Tests
66
on:
77
pull_request:
88
branches:
9-
- '**' # Run on PR open, update, or synchronize (i.e., any push to PR branch)
9+
- "**" # Run on PR open, update, or synchronize (i.e., any push to PR branch)
1010

1111
# Global timeout for all jobs
1212
# Note: GitHub Actions uses minutes, GitLab uses duration strings
1313
jobs:
1414
developer_tests:
1515
name: Lint, Type Check, and Test
1616
runs-on: ubuntu-latest
17-
timeout-minutes: 120 # 2 hours
18-
17+
timeout-minutes: 120 # 2 hours
18+
1919
# Use Python 3.13 to match GitLab configuration
2020
container:
2121
image: python:3.13-bookworm
22-
22+
2323
steps:
2424
- name: Checkout code
2525
uses: actions/checkout@v4
2626
with:
27-
fetch-depth: 0 # Fetch all history for git diff in typecheck-pr
28-
27+
fetch-depth: 0 # Fetch all history for git diff in typecheck-pr
28+
2929
- name: Set up Git safe directory
3030
run: |
3131
git config --global --add safe.directory "$GITHUB_WORKSPACE"
32-
32+
3333
- name: Fetch base branch
3434
run: |
3535
git fetch origin ${{ github.base_ref || 'main' }}:refs/remotes/origin/${{ github.base_ref || 'main' }}
3636
git branch -a
37-
37+
3838
- name: Set up environment
3939
run: |
4040
python --version
4141
apt-get update -y
4242
apt-get install make curl -y
43-
43+
4444
- name: Install uv
4545
run: |
4646
curl -LsSf https://astral.sh/uv/install.sh | sh
4747
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
48-
48+
4949
- name: Create virtual environment
5050
run: |
5151
uv venv .venv
5252
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
53-
53+
5454
- name: Install Node.js and basedpyright
5555
run: |
5656
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
5757
apt-get install -y nodejs
5858
npm install -g basedpyright
59-
59+
6060
- name: Install Python dependencies
6161
run: |
6262
uv pip install ruff
6363
uv pip install typer rich boto3
6464
cd lib/idp_common_pkg && uv pip install -e ".[test]" && cd ../..
65-
65+
6666
- name: Run linting checks
6767
run: make lint-cicd
68-
68+
6969
- name: Run type checking
7070
run: |
7171
TARGET_BRANCH="${{ github.base_ref }}"
@@ -74,14 +74,14 @@ jobs:
7474
echo "Comparing: origin/$TARGET_BRANCH...HEAD"
7575
echo "===================================="
7676
echo ""
77-
78-
python3 scripts/typecheck_pr_changes.py "$TARGET_BRANCH"
79-
77+
78+
make typecheck-pr TARGET_BRANCH="$TARGET_BRANCH"
79+
8080
- name: Run tests
8181
id: run-tests
8282
run: make test-cicd -C lib/idp_common_pkg
8383
continue-on-error: false
84-
84+
8585
- name: Upload coverage reports
8686
uses: actions/upload-artifact@v4
8787
if: always() && steps.run-tests.outcome != 'skipped'
@@ -91,14 +91,14 @@ jobs:
9191
lib/idp_common_pkg/test-reports/coverage.xml
9292
lib/idp_common_pkg/test-reports/test-results.xml
9393
retention-days: 7
94-
94+
9595
- name: Publish test results
9696
uses: EnricoMi/publish-unit-test-result-action@v2
9797
if: always() && hashFiles('lib/idp_common_pkg/test-reports/test-results.xml') != ''
9898
with:
9999
files: lib/idp_common_pkg/test-reports/test-results.xml
100100
check_name: Test Results
101-
101+
102102
- name: Code Coverage Report
103103
uses: irongut/CodeCoverageSummary@v1.3.0
104104
if: always() && hashFiles('lib/idp_common_pkg/test-reports/coverage.xml') != ''
@@ -111,8 +111,8 @@ jobs:
111111
hide_complexity: true
112112
indicators: true
113113
output: both
114-
thresholds: '60 80'
115-
114+
thresholds: "60 80"
115+
116116
# Note: PR comments disabled for fork PRs due to permission restrictions
117117
# Coverage results are available in:
118118
# 1. Workflow artifacts (test-reports)

.gitlab-ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ stages:
2626
developer_tests:
2727
stage: developer_tests
2828
rules:
29-
- when: always # Run on all branches
29+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
30+
when: always # Only run on merge requests (PRs), not on merged branches
3031

3132
before_script:
3233
- python --version
3334
- apt-get update -y
3435
- apt-get install make curl git -y
35-
# Fetch main branch for comparison in typecheck-pr
36-
- git fetch origin main:main || echo "Could not fetch main branch"
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"
3740
# Install uv
3841
- pip install uv
3942
# Create virtual environment
@@ -51,7 +54,12 @@ developer_tests:
5154

5255
script:
5356
- make lint-cicd
54-
- make typecheck-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
5563
- make test-cicd -C lib/idp_common_pkg
5664

5765
artifacts:
@@ -128,4 +136,3 @@ integration_tests:
128136

129137
# Run integration test deployment
130138
- python3 scripts/integration_test_deployment.py
131-

Makefile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,7 @@ typecheck-pr:
8989
@echo "Type checking changed files against $(TARGET_BRANCH)..."
9090
python3 scripts/typecheck_pr_changes.py $(TARGET_BRANCH)
9191

92-
# CI/CD version of type check - checks PR changes only
93-
typecheck-cicd:
94-
@echo "Running type quality checks on PR changes..."
95-
@if ! python3 scripts/typecheck_pr_changes.py $(TARGET_BRANCH); then \
96-
echo -e "$(RED)ERROR: Type checking failed!$(NC)"; \
97-
echo -e "$(YELLOW)Please run 'make typecheck-pr' locally to fix these issues.$(NC)"; \
98-
exit 1; \
99-
fi
100-
@echo -e "$(GREEN)All type checks passed!$(NC)"
10192

102-
# A convenience Makefile target that runs
10393
commit: lint test
10494
$(info Generating commit message...)
10595
export COMMIT_MESSAGE="$(shell q chat --no-interactive --trust-all-tools "Understand pending local git change and changes to be committed, then infer a commit message. Return this commit message only" | tail -n 1 | sed 's/\x1b\[[0-9;]*m//g')" && \

0 commit comments

Comments
 (0)