Fix running buildrunner in docker, and deprecate this functionality #886
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| # Only run workflow when there is push to main or when there is a pull request to main | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| # When running with act (https://github.com/nektos/act), these lines need to be appended with the ACT variable | |
| # to force each job to run | |
| if: github.repository == 'adobe/buildrunner' #|| ${{ env.ACT }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.9' | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Install dev dependencies | |
| - name: Install dependencies | |
| run: uv sync --locked | |
| - name: Pre-commit checks | |
| run: uv run pre-commit run --all-files | |
| - name: Test with pytest | |
| # Create the ssh key file once for all testing | |
| run: | | |
| ssh-keygen -t ecdsa -m PEM -N '' -f /tmp/buildrunner-test-id_rsa | |
| uv run pytest -v -m "not serial" --numprocesses=auto --junitxml=test-reports/non-serial-test-results.xml | |
| uv run pytest -v -m "serial" --junitxml=test-reports/serial-test-results.xml | |
| uv run python scripts/combine_xml.py test-reports/serial-test-results.xml test-reports/non-serial-test-results.xml > test-reports/test-results.xml | |
| - name: Publish test results | |
| uses: EnricoMi/publish-unit-test-result-action/linux@v2 | |
| if: always() | |
| with: | |
| files: test-reports/test-results.xml | |
| check_name: "Test Results ${{ matrix.python-version }}" | |
| github_retries: 10 | |
| secondary_rate_limit_wait_seconds: 60.0 | |
| get-version: | |
| if: github.repository == 'adobe/buildrunner' | |
| runs-on: ubuntu-latest | |
| needs: test | |
| outputs: | |
| current-version: ${{ steps.version-number.outputs.CURRENT_VERSION }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| # Fetch all history instead of the latest commit | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: uv sync --locked | |
| - name: Get current version | |
| id: version-number | |
| run: echo "CURRENT_VERSION=$(uv version --short).$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT | |
| - name: Print current version | |
| run: echo CURRENT_VERSION ${{ steps.version-number.outputs.CURRENT_VERSION }} | |
| tag-commit: | |
| if: github.repository == 'adobe/buildrunner' && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: [test, get-version] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| # Fetch all history instead of the latest commit | |
| fetch-depth: 0 | |
| - name: Tag commit | |
| run: git tag ${{ needs.get-version.outputs.current-version }} && git push --tags | |
| publish-pypi: | |
| if: github.repository == 'adobe/buildrunner' | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| # Fetch all history instead of the latest commit | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: uv sync --locked | |
| - name: Set version | |
| run: uv version --no-sync "$(uv version --short).$(git rev-list --count HEAD)" | |
| - name: Build | |
| run: uv build | |
| - name: Check upload | |
| run: uv run --with twine twine check dist/* | |
| - name: Publish to PyPi | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Only publish on pushes to main | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.ADOBE_BOT_PYPI_TOKEN }} | |
| publish-docker: | |
| if: github.repository == 'adobe/buildrunner' | |
| runs-on: ubuntu-latest | |
| needs: [test, get-version] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| # Fetch all history instead of the latest commit | |
| fetch-depth: 0 | |
| - name: Docker Tags | |
| id: docker_tags | |
| uses: docker/metadata-action@v3 | |
| with: | |
| images: ghcr.io/adobe/buildrunner | |
| tags: | | |
| latest | |
| ${{ needs.get-version.outputs.current-version }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v1 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| # Buildx is used to build multi-platform images | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| # Login to the docker registry | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v1 | |
| # Only login if this a push to main | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Image | |
| uses: docker/build-push-action@v2 | |
| with: | |
| context: . | |
| # Only push images if this is a push to main | |
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.docker_tags.outputs.tags }} | |
| labels: ${{ steps.docker_tags.outputs.labels }} |