|
| 1 | +#<!-- |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | +#--> |
| 19 | +# Validates the Apache release pipeline on every PR: builds the real release |
| 20 | +# artifacts (git archive, sdist, wheel) using the release script with |
| 21 | +# --skip-signing, runs Apache RAT on the source tarball, then installs the |
| 22 | +# wheel into a fresh venv outside the source tree and smoke-tests the server. |
| 23 | +# |
| 24 | +# This is designed to catch the class of bugs that have broken recent RCs: |
| 25 | +# license/header issues (RAT), examples missing from the wheel (smoke test), |
| 26 | +# and general "voter tries to install this and it breaks" failures. |
| 27 | + |
| 28 | +name: Release Validation |
| 29 | + |
| 30 | +on: |
| 31 | + push: |
| 32 | + branches: |
| 33 | + - main |
| 34 | + tags: |
| 35 | + - 'v*.*.*-incubating-RC*' |
| 36 | + pull_request: |
| 37 | + types: [opened, synchronize, reopened] |
| 38 | + paths-ignore: |
| 39 | + - 'docs/**' |
| 40 | + - 'website/**' |
| 41 | + # Note: do NOT use '**/*.md' here. Some bundled examples ship .md files |
| 42 | + # (e.g. examples/deployment/aws/terraform/tutorial.md) and a missing |
| 43 | + # ASF header on those would cause a real RAT failure we want to catch. |
| 44 | + workflow_dispatch: |
| 45 | + |
| 46 | +concurrency: |
| 47 | + group: release-validation-${{ github.ref }} |
| 48 | + cancel-in-progress: true |
| 49 | + |
| 50 | +permissions: |
| 51 | + contents: read |
| 52 | + |
| 53 | +jobs: |
| 54 | + build-artifacts: |
| 55 | + name: build-artifacts |
| 56 | + runs-on: ubuntu-latest |
| 57 | + timeout-minutes: 20 |
| 58 | + outputs: |
| 59 | + version: ${{ steps.version.outputs.version }} |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - uses: actions/setup-python@v4 |
| 64 | + with: |
| 65 | + python-version: '3.12' |
| 66 | + cache: pip |
| 67 | + |
| 68 | + - uses: actions/setup-node@v4 |
| 69 | + with: |
| 70 | + node-version: '20' |
| 71 | + cache: npm |
| 72 | + cache-dependency-path: telemetry/ui/package-lock.json |
| 73 | + |
| 74 | + - uses: actions/setup-java@v4 |
| 75 | + with: |
| 76 | + distribution: temurin |
| 77 | + java-version: '17' |
| 78 | + |
| 79 | + - name: Install system deps |
| 80 | + run: sudo apt-get install -y --no-install-recommends graphviz |
| 81 | + |
| 82 | + - name: Install Python build deps |
| 83 | + run: pip install flit twine |
| 84 | + |
| 85 | + - name: Cache Apache RAT |
| 86 | + id: cache-rat |
| 87 | + uses: actions/cache@v4 |
| 88 | + with: |
| 89 | + path: ~/.cache/apache-rat |
| 90 | + key: apache-rat-0.16.1 |
| 91 | + |
| 92 | + - name: Download Apache RAT if not cached |
| 93 | + if: steps.cache-rat.outputs.cache-hit != 'true' |
| 94 | + run: | |
| 95 | + mkdir -p ~/.cache/apache-rat |
| 96 | + curl -fL -o ~/.cache/apache-rat/apache-rat-0.16.1.jar \ |
| 97 | + https://repo1.maven.org/maven2/org/apache/rat/apache-rat/0.16.1/apache-rat-0.16.1.jar |
| 98 | +
|
| 99 | + - name: Extract version |
| 100 | + id: version |
| 101 | + run: | |
| 102 | + VERSION=$(python -c 'import re; print(re.search(r"version\s*=\s*\"([^\"]+)\"", open("pyproject.toml").read()).group(1))') |
| 103 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 104 | + echo "BURR_VERSION=$VERSION" >> "$GITHUB_ENV" |
| 105 | +
|
| 106 | + - name: Build release artifacts (no signing, no upload) |
| 107 | + run: | |
| 108 | + python scripts/apache_release.py all "$BURR_VERSION" 0 ci-runner \ |
| 109 | + --skip-signing --no-upload |
| 110 | +
|
| 111 | + - name: Verify all 3 artifacts exist |
| 112 | + run: | |
| 113 | + test -f "dist/apache-burr-${BURR_VERSION}-incubating-src.tar.gz" |
| 114 | + test -f "dist/apache-burr-${BURR_VERSION}-incubating-sdist.tar.gz" |
| 115 | + test -f "dist/apache_burr-${BURR_VERSION}-py3-none-any.whl" |
| 116 | +
|
| 117 | + - name: Run Apache RAT on source and sdist tarballs |
| 118 | + run: | |
| 119 | + python scripts/verify_apache_artifacts.py licenses \ |
| 120 | + --rat-jar ~/.cache/apache-rat/apache-rat-0.16.1.jar \ |
| 121 | + --artifacts-dir dist |
| 122 | +
|
| 123 | + - name: Upload release artifacts |
| 124 | + uses: actions/upload-artifact@v4 |
| 125 | + with: |
| 126 | + name: release-artifacts |
| 127 | + path: | |
| 128 | + dist/*.tar.gz |
| 129 | + dist/*.whl |
| 130 | + dist/*.sha512 |
| 131 | + dist/rat-report-*.xml |
| 132 | + dist/rat-report-*.txt |
| 133 | + retention-days: 14 |
| 134 | + |
| 135 | + install-and-smoke: |
| 136 | + name: install-and-smoke |
| 137 | + needs: build-artifacts |
| 138 | + runs-on: ubuntu-latest |
| 139 | + timeout-minutes: 10 |
| 140 | + strategy: |
| 141 | + fail-fast: false |
| 142 | + matrix: |
| 143 | + # 3.9 is skipped because burr/cli/__main__.py uses PEP 604 union syntax |
| 144 | + # (dict | None) which requires Python 3.10+. Tracked separately. |
| 145 | + python-version: ['3.10', '3.11', '3.12'] |
| 146 | + steps: |
| 147 | + - uses: actions/checkout@v4 |
| 148 | + |
| 149 | + - name: Set up Python ${{ matrix.python-version }} |
| 150 | + uses: actions/setup-python@v4 |
| 151 | + with: |
| 152 | + python-version: ${{ matrix.python-version }} |
| 153 | + |
| 154 | + - name: Download release artifacts |
| 155 | + uses: actions/download-artifact@v4 |
| 156 | + with: |
| 157 | + name: release-artifacts |
| 158 | + path: dist |
| 159 | + |
| 160 | + - name: Run smoke test |
| 161 | + env: |
| 162 | + BURR_VERSION: ${{ needs.build-artifacts.outputs.version }} |
| 163 | + run: | |
| 164 | + python scripts/ci_smoke_server.py \ |
| 165 | + --wheel "dist/apache_burr-${BURR_VERSION}-py3-none-any.whl" |
| 166 | +
|
| 167 | + - name: Upload smoke workspace on failure |
| 168 | + if: failure() |
| 169 | + uses: actions/upload-artifact@v4 |
| 170 | + with: |
| 171 | + name: smoke-workspace-${{ matrix.python-version }} |
| 172 | + path: /tmp/burr-smoke-* |
| 173 | + retention-days: 7 |
| 174 | + if-no-files-found: ignore |
0 commit comments