-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (117 loc) · 5.21 KB
/
Copy pathpr.yml
File metadata and controls
129 lines (117 loc) · 5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Pull Request Validation
# Workflow Behavior:
# - PRs: Fast CI tests (test-ci) on Python 3.11 only (15min timeout)
# - Dev tags (v*-dev-*): Comprehensive tests (coverage) on Python 3.11, 3.12, 3.13 (30min timeout)
#
# To trigger comprehensive tests on-demand:
# make release-dev # Creates and pushes v{version}-dev-{timestamp} tag
#
# This allows thorough testing before merging without slowing down regular PR development.
on:
pull_request:
branches: ['**']
push:
tags: ['v*-dev-*']
jobs:
test:
runs-on: ubuntu-latest
# Increase timeout for comprehensive tests on dev tags
timeout-minutes: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') && 30 || 15 }}
strategy:
matrix:
# Run comprehensive tests on multiple Python versions for dev tags
python-version: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') && fromJSON('["3.13", "3.12", "3.11"]') || fromJSON('["3.11"]') }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup build environment
uses: ./.github/actions/setup-build-env
with:
python-version: ${{ matrix.python-version }}
- name: Run linting
shell: bash
run: make lint
- name: Run tests
uses: ./.github/actions/run-tests
with:
# Use comprehensive tests (coverage) for dev tags, fast tests (test-ci) for PRs
test-target: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') && 'coverage' || 'test-ci' }}
artifact-name: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') && 'test-results-dev-comprehensive' || 'test-results-pr' }}
python-version: ${{ matrix.python-version }}
env:
# AWS credentials for tests that need them
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION || 'us-east-1' }}
# Quilt configuration
QUILT_TEST_BUCKET: ${{ secrets.QUILT_TEST_BUCKET }}
QUILT_CATALOG_URL: ${{ secrets.QUILT_CATALOG_URL }}
QUILT_TEST_PACKAGE: ${{ secrets.QUILT_TEST_PACKAGE }}
QUILT_TEST_ENTRY: ${{ secrets.QUILT_TEST_ENTRY }}
PLATFORM_TEST_ENABLED: ${{ secrets.PLATFORM_CATALOG_URL != '' && 'true' || 'false' }}
PLATFORM_CATALOG_URL: ${{ secrets.PLATFORM_CATALOG_URL }}
PLATFORM_REGISTRY_URL: ${{ secrets.PLATFORM_REGISTRY_URL }}
PLATFORM_TEST_JWT_SECRET: ${{ secrets.PLATFORM_TEST_JWT_SECRET }}
- name: Debug GitHub context for dev-release
run: |
echo "=== GitHub Context Debug ==="
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
echo "Ref type: ${{ github.ref_type }}"
echo "Ref name: ${{ github.ref_name }}"
echo "Head ref: ${{ github.head_ref }}"
echo "Base ref: ${{ github.base_ref }}"
echo "SHA: ${{ github.sha }}"
echo "=== Tag Detection ==="
echo "Starts with refs/tags/v: ${{ startsWith(github.ref, 'refs/tags/v') }}"
echo "Contains -dev-: ${{ contains(github.ref, '-dev-') }}"
echo "Combined condition: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') }}"
dev-release:
runs-on: ubuntu-latest
needs: test
timeout-minutes: 30
environment: testpypi
permissions:
contents: write
id-token: write
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-')
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup build environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.11'
include-nodejs: 'true'
- name: Debug dev-release context
run: |
echo "=== Dev-Release Context Debug ==="
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
echo "Ref type: ${{ github.ref_type }}"
echo "Ref name: ${{ github.ref_name }}"
echo "SHA: ${{ github.sha }}"
echo "=== Condition Check ==="
echo "startsWith(github.ref, 'refs/tags/v'): ${{ startsWith(github.ref, 'refs/tags/v') }}"
echo "contains(github.ref, '-dev-'): ${{ contains(github.ref, '-dev-') }}"
echo "Combined condition result: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') }}"
- name: Extract version from tag
id: version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
echo "Dev Tag Version: $TAG_VERSION"
- name: Create dev release
uses: ./.github/actions/create-release
with:
package-version: ${{ steps.version.outputs.tag_version }}
git-sha: ${{ github.sha }}
pypi-repository-url: https://test.pypi.org/legacy/
build-docker: 'true'
skip-existing: true
env:
# AWS credentials for Docker ECR push
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION || 'us-east-1' }}