Merge pull request #91 from lfreleng-actions/pre-commit-ci-update-config #302
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 🧪" | |
| # yamllint disable-line rule:truthy | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| permissions: {} | |
| env: | |
| python_version: "3.12" | |
| jobs: | |
| ### Test the GitHub Action in this Repository ### | |
| tests: | |
| name: "Run Tests 🧪" | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| timeout-minutes: 12 | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| # Perform setup prior to running test(s) | |
| - name: "Checkout sample project repository" | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| repository: "lfreleng-actions/test-python-project" | |
| path: "test-python-project" | |
| # Build sample Python project | |
| - name: "Build Python project" | |
| id: build | |
| # yamllint disable-line rule:line-length | |
| uses: lfreleng-actions/python-build-action@8f567398591014dd5627961aaa9ec17816b072f0 # v1.0.2 | |
| with: | |
| path_prefix: "test-python-project" | |
| tox_build: false | |
| # Perform Python project standard tests | |
| - name: "Run action: ${{ github.repository }} [PYTEST]" | |
| uses: ./ | |
| with: | |
| python_version: ${{ env.python_version }} | |
| path_prefix: "test-python-project" | |
| tests_path: "tests" | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| # Perform Python project failing tests | |
| - name: "Run action: ${{ github.repository }} [Test Failure]" | |
| uses: ./ | |
| with: | |
| python_version: ${{ env.python_version }} | |
| path_prefix: "test-python-project" | |
| report_artefact: false | |
| # Test permit failure using action input | |
| tests_path: "tests_fail" | |
| permit_fail: true | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| # Perform Python project failing tests | |
| - name: "Run action: ${{ github.repository }} [Test Failure]" | |
| id: tests-fail | |
| uses: ./ | |
| continue-on-error: true | |
| with: | |
| python_version: ${{ env.python_version }} | |
| path_prefix: "test-python-project" | |
| report_artefact: false | |
| # Test permit failure using action input | |
| tests_path: "tests_fail" | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Validate previous step failure" | |
| if: steps.tests-fail.outcome == 'success' | |
| shell: bash | |
| run: | | |
| # Check previous step failure | |
| echo "Error: previous step should have failed ❌" | |
| exit 1 |