test #563
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: test | |
| on: | |
| # Run on each commit. | |
| push: | |
| # Run on pull requests. | |
| pull_request: | |
| branches: | |
| - main | |
| # Run daily at UTC midnight. | |
| schedule: | |
| - cron: "0 0 * * *" | |
| # Can be launched manually in github actions tab. | |
| workflow_dispatch: # Allows manual trigger | |
| inputs: | |
| commit_sha: | |
| description: "[Optional] commit SHA to test" | |
| required: false | |
| default: "" | |
| verbose: | |
| description: "Verbose [false|true]" | |
| required: false | |
| default: "false" | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| matrix: | |
| # 'macos-latest' -> darwin apple silicon | |
| # 'macos-15-intel' -> darwin intel x86 | |
| os: [ubuntu-22.04, macos-latest, macos-15-intel, windows-latest] | |
| python-version: ['3.11', "3.12", "3.13", "3.14"] | |
| steps: | |
| - name: Show architecture | |
| run: uname -a | |
| - name: Determine commit to use | |
| run: | | |
| # Strip leading and trailing spaces | |
| sha="$(echo "${{ github.event.inputs.commit_sha }}" | xargs)" | |
| # User specified commit SHA. | |
| if [ -n "$sha" ]; then | |
| echo "COMMIT_SHA=$sha" >> $GITHUB_ENV | |
| echo "COMMIT_NOTE=Using manual commit" >> $GITHUB_ENV | |
| # Default behavior, use latest commit. | |
| else | |
| echo "COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV | |
| echo "COMMIT_NOTE=Using latest commit" >> $GITHUB_ENV | |
| fi | |
| - name: Show selected commit | |
| run: | | |
| echo "$COMMIT_NOTE" | |
| echo "Selected: $COMMIT_SHA" | |
| echo "Latest: ${{github.sha}}" | |
| - name: Checkout apio | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{env.COMMIT_SHA}} | |
| - name: Install python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Show python version | |
| run: python --version | |
| - name: Install dev tools | |
| run: | | |
| pip install invoke | |
| invoke install-deps | |
| # TODO: Move the logic here to an Invoke task and use it instead. | |
| - name: Run Tests | |
| run: | | |
| # Convert py version such as '3.13' to 'py313' as required by tox.ini. | |
| pyver="py${{matrix.python-version}}" | |
| echo "pyver: [$pyver]" | |
| pyver=${pyver//./} | |
| echo "pyver: [$pyver]" | |
| # Determine if we run in verbose mode. This can be enabled | |
| # in the github dashboard when running the workflow manuall.y. | |
| echo "Original verbose: [${{ github.event.inputs.verbose }}]" | |
| verbose="${{ github.event.inputs.verbose || 'false' }}" | |
| echo "Effective verbose: [${verbose}]" | |
| if [[ "$verbose" != "true" && "$verbose" != "false" ]]; then | |
| echo "Error: 'verbose' must be 'true' or 'false'." | |
| exit 1 | |
| fi | |
| # Determine the posargs to pass to pytest. | |
| if [ "${verbose}" = "true" ]; then | |
| echo "Verbose mode ON" | |
| posargs="-s" | |
| else | |
| echo "Verbose mode OFF" | |
| posargs="" | |
| fi | |
| # Run the tests | |
| python -m tox --skip-missing-interpreters false -e lint,$pyver -- ${posargs} |