|
| 1 | +name: validate-patches |
| 2 | + |
| 3 | +# Rebase this branch onto upstream/develop on a schedule and run the |
| 4 | +# python_uv unit + integration tests. Fails loud (opens an issue) if the |
| 5 | +# rebase conflicts or any test breaks — so we get an early signal when an |
| 6 | +# upstream change makes one of our carried patches obsolete or wrong. |
| 7 | + |
| 8 | +on: |
| 9 | + schedule: |
| 10 | + - cron: "0 6 * * 1" # Mondays 06:00 UTC |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + issues: write |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: validate-patches |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + rebase-and-test: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: checkout patched-stack |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: patched-stack |
| 29 | + fetch-depth: 0 |
| 30 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + |
| 32 | + - name: configure git |
| 33 | + run: | |
| 34 | + git config user.name "patch-bot" |
| 35 | + git config user.email "patch-bot@users.noreply.github.com" |
| 36 | +
|
| 37 | + - name: fetch upstream develop |
| 38 | + run: | |
| 39 | + git remote add upstream https://github.com/aws/aws-lambda-builders.git |
| 40 | + git fetch upstream develop |
| 41 | +
|
| 42 | + - name: rebase onto upstream/develop |
| 43 | + id: rebase |
| 44 | + run: | |
| 45 | + if ! git rebase upstream/develop; then |
| 46 | + git rebase --abort |
| 47 | + echo "rebase_failed=true" >> "$GITHUB_OUTPUT" |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | +
|
| 51 | + - uses: actions/setup-python@v5 |
| 52 | + with: |
| 53 | + python-version: "3.12" |
| 54 | + |
| 55 | + - name: install uv |
| 56 | + uses: astral-sh/setup-uv@v7 |
| 57 | + |
| 58 | + - name: install package + test deps |
| 59 | + run: | |
| 60 | + python -m pip install --upgrade pip |
| 61 | + pip install -e . pytest mock parameterized |
| 62 | +
|
| 63 | + - name: run python_uv unit tests |
| 64 | + run: pytest -vv tests/unit/workflows/python_uv |
| 65 | + |
| 66 | + - name: run python_uv integration tests |
| 67 | + run: pytest -vv tests/integration/workflows/python_uv |
| 68 | + |
| 69 | + - name: push rebased patched-stack |
| 70 | + run: git push --force-with-lease origin patched-stack |
| 71 | + |
| 72 | + - name: file issue on failure |
| 73 | + if: failure() |
| 74 | + uses: actions/github-script@v7 |
| 75 | + with: |
| 76 | + script: | |
| 77 | + const title = "patched-stack failed to rebase or test against upstream/develop"; |
| 78 | + const body = [ |
| 79 | + `Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, |
| 80 | + ``, |
| 81 | + `Stack carries:`, |
| 82 | + `- fix(python-uv): cached build copies dependencies to the build dir (PR #870 upstream)`, |
| 83 | + `- fix(python-uv): pass --no-default-groups to uv export (PR #869 upstream)`, |
| 84 | + ``, |
| 85 | + `Once either PR merges, drop the matching commit from patched-stack.`, |
| 86 | + ].join("\n"); |
| 87 | + const { data: existing } = await github.rest.issues.listForRepo({ |
| 88 | + owner: context.repo.owner, |
| 89 | + repo: context.repo.repo, |
| 90 | + state: "open", |
| 91 | + labels: "patch-validation", |
| 92 | + }); |
| 93 | + if (existing.length === 0) { |
| 94 | + await github.rest.issues.create({ |
| 95 | + owner: context.repo.owner, |
| 96 | + repo: context.repo.repo, |
| 97 | + title, |
| 98 | + body, |
| 99 | + labels: ["patch-validation"], |
| 100 | + }); |
| 101 | + } |
0 commit comments