Feat: Add path_prefix output for downstream actions #430
Workflow file for this run
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
| --- | |
| # SPDX-License-Identifier: Apache-2.0 | |
| # SPDX-FileCopyrightText: 2025 The Linux Foundation | |
| # Action test/validation workflow | |
| name: "Test GitHub Action 🧪" | |
| on: # yamllint disable-line rule:truthy | |
| workflow_dispatch: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| tests: | |
| name: "Test local GitHub Action" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| timeout-minutes: 10 | |
| steps: | |
| # Harden the runner used by this workflow | |
| # yamllint disable-line rule:line-length | |
| - uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 | |
| with: | |
| egress-policy: 'audit' | |
| - name: "Checkout repository" | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: "Checkout sample project repository" | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: "lfreleng-actions/test-python-project" | |
| path: "test-python-project" | |
| - name: "Run action: ${{ github.repository }} [Static versioning]" | |
| uses: ./ | |
| with: | |
| path_prefix: "test-python-project" | |
| - name: "Run action: ${{ github.repository }} [Build using TOX]" | |
| uses: ./ | |
| with: | |
| path_prefix: "test-python-project" | |
| purge_artefact_path: true | |
| tox_build: true | |
| - name: "Run action: ${{ github.repository }} [Explicit versioning]" | |
| uses: ./ | |
| with: | |
| path_prefix: "test-python-project/" | |
| purge_artefact_path: true | |
| tag: "v2.0.0" | |
| artefact_path: "explicit_tag" | |
| - name: "Validate artefacts from explicit build" | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if (find 'test-python-project/explicit_tag' -name '*2.0.0*'); then | |
| echo "Explicit tag/artefact path as expected ✅" | |
| else | |
| echo "Error: build artefact validation failed ❌"; exit 1 | |
| fi | |
| - name: "Setup dynamic versioning/PDM" | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cp test-python-project/variations/dynamic.toml \ | |
| test-python-project/pyproject.toml | |
| - name: "Run action: ${{ github.repository }} [Dynamic versioning/PDM]" | |
| uses: ./ | |
| with: | |
| path_prefix: "test-python-project" | |
| purge_artefact_path: true | |
| test-python-projects: | |
| name: "${{ matrix.project }}" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Test projects are defined in the TEST_PROJECTS repository variable | |
| # Deliberately includes a wide variety of sources | |
| # All are public and accessible to the runner | |
| project: ${{ fromJSON(vars.TEST_PROJECTS) }} | |
| steps: | |
| # Harden the runner used by this workflow | |
| # yamllint disable-line rule:line-length | |
| - uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 | |
| with: | |
| egress-policy: 'audit' | |
| - name: "Checkout action repository" | |
| # yamllint disable-line rule:line-length | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: "Checkout project repository: ${{ matrix.project }}" | |
| # yamllint disable-line rule:line-length | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: "${{ matrix.project }}" | |
| path: "project" | |
| - name: "Building: ${{ matrix.project }}" | |
| uses: ./ | |
| with: | |
| path_prefix: "project" | |
| test-multi-arch-projects: | |
| name: "${{ matrix.project }} [${{ matrix.arch.name }}]" | |
| runs-on: ${{ matrix.arch.runner }} | |
| permissions: | |
| contents: read | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Multi-arch test projects are defined in the MULTI_ARCH_TEST_PROJECTS | |
| # repository variable; these build for both x86_64 and ARM64 | |
| project: ${{ fromJSON(vars.MULTI_ARCH_TEST_PROJECTS) }} | |
| arch: | |
| - name: x86_64 | |
| runner: ubuntu-latest | |
| - name: aarch64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| # Harden the runner used by this workflow | |
| # yamllint disable-line rule:line-length | |
| - uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 | |
| with: | |
| egress-policy: 'audit' | |
| - name: "Checkout action repository" | |
| # yamllint disable-line rule:line-length | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: "Checkout project repository: ${{ matrix.project }}" | |
| # yamllint disable-line rule:line-length | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: "${{ matrix.project }}" | |
| path: "project" | |
| - name: "Building: ${{ matrix.project }} [${{ matrix.arch.name }}]" | |
| uses: ./ | |
| with: | |
| path_prefix: "project" | |
| auditwheel: true | |
| manylinux_version: manylinux_2_34 | |
| build_formats: wheel | |
| # Both projects in MULTI_ARCH_TEST_PROJECTS have Makefiles | |
| make: true | |
| make_args: "-j$(nproc)" |