gh-131876: extract _hashlib helpers into a separate directory [WIP]
          
            #161663
        
      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
    
  
  
    
  | name: Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'main' | |
| - '3.*' | |
| pull_request: | |
| branches: | |
| - 'main' | |
| - '3.*' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency | |
| # 'group' must be a key uniquely representing a PR or push event. | |
| # github.workflow is the workflow name | |
| # github.actor is the user invoking the workflow | |
| # github.head_ref is the source branch of the PR or otherwise blank | |
| # github.run_id is a unique number for the current run | |
| group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_COLOR: 1 | |
| jobs: | |
| build-context: | |
| name: Change detection | |
| # To use boolean outputs from this job, parse them as JSON. | |
| # Here's some examples: | |
| # | |
| # if: fromJSON(needs.build-context.outputs.run-docs) | |
| # | |
| # ${{ | |
| # fromJSON(needs.build-context.outputs.run-tests) | |
| # && 'truthy-branch' | |
| # || 'falsy-branch' | |
| # }} | |
| # | |
| uses: ./.github/workflows/reusable-context.yml | |
| check-autoconf-regen: | |
| name: 'Check if Autoconf files are up to date' | |
| # Don't use ubuntu-latest but a specific version to make the job | |
| # reproducible: to get the same tools versions (autoconf, aclocal, ...) | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ghcr.io/python/autoconf:2025.01.02.12581854023 | |
| timeout-minutes: 60 | |
| needs: build-context | |
| if: needs.build-context.outputs.run-tests == 'true' | |
| steps: | |
| - name: Install Git | |
| run: | | |
| apt update && apt install git -yq | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: Check Autoconf and aclocal versions | |
| run: | | |
| grep "Generated by GNU Autoconf 2.72" configure | |
| grep "aclocal 1.16.5" aclocal.m4 | |
| grep -q "runstatedir" configure | |
| grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4 | |
| - name: Regenerate autoconf files | |
| # Same command used by Tools/build/regen-configure.sh ($AUTORECONF) | |
| run: autoreconf -ivf -Werror | |
| - name: Check for changes | |
| run: | | |
| git add -u | |
| changes=$(git status --porcelain) | |
| # Check for changes in regenerated files | |
| if test -n "$changes"; then | |
| echo "Generated files not up to date." | |
| echo "Perhaps you forgot to run make regen-configure ;)" | |
| echo "configure files must be regenerated with a specific version of autoconf." | |
| echo "$changes" | |
| echo "" | |
| git diff --staged || true | |
| exit 1 | |
| fi | |
| check-generated-files: | |
| name: 'Check if generated files are up to date' | |
| # Don't use ubuntu-latest but a specific version to make the job | |
| # reproducible: to get the same tools versions (autoconf, aclocal, ...) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| needs: build-context | |
| if: needs.build-context.outputs.run-tests == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Runner image version | |
| run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV" | |
| - name: Restore config.cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: config.cache | |
| # Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python | |
| key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }} | |
| - name: Install dependencies | |
| run: sudo ./.github/workflows/posix-deps-apt.sh | |
| - name: Add ccache to PATH | |
| run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV" | |
| - name: Configure ccache action | |
| uses: hendrikmuhs/[email protected] | |
| with: | |
| save: false | |
| - name: Configure CPython | |
| run: | | |
| # Build Python with the libpython dynamic library | |
| ./configure --config-cache --with-pydebug --enable-shared | |
| - name: Build CPython | |
| run: | | |
| make -j4 regen-all | |
| make regen-stdlib-module-names regen-sbom regen-unicodedata | |
| - name: Check for changes | |
| run: | | |
| git add -u | |
| changes=$(git status --porcelain) | |
| # Check for changes in regenerated files | |
| if test -n "$changes"; then | |
| echo "Generated files not up to date." | |
| echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)" | |
| echo "configure files must be regenerated with a specific version of autoconf." | |
| echo "$changes" | |
| echo "" | |
| git diff --staged || true | |
| exit 1 | |
| fi | |
| - name: Check exported libpython symbols | |
| run: make smelly | |
| - name: Check limited ABI symbols | |
| run: make check-limited-abi | |
| - name: Check for unsupported C global variables | |
| if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME | |
| run: make check-c-globals | |
| build-windows: | |
| name: >- | |
| Windows | |
| ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} | |
| needs: build-context | |
| if: fromJSON(needs.build-context.outputs.run-windows-tests) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - x64 | |
| free-threading: | |
| - false | |
| exclude: | |
| # Skip Win32 on free-threaded builds | |
| - { arch: Win32, free-threading: true } | |
| uses: ./.github/workflows/reusable-windows.yml | |
| with: | |
| arch: ${{ matrix.arch }} | |
| free-threading: ${{ matrix.free-threading }} | |
| build-wasi: | |
| name: 'WASI' | |
| needs: build-context | |
| if: needs.build-context.outputs.run-tests == 'true' | |
| uses: ./.github/workflows/reusable-wasi.yml | |
| with: | |
| config_hash: ${{ needs.build-context.outputs.config-hash }} | |
| all-required-green: # This job does nothing and is only used for the branch protection | |
| name: All required checks pass | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| needs: | |
| - build-context # Transitive dependency, needed to access `run-tests` value | |
| - check-autoconf-regen | |
| - check-generated-files | |
| - build-windows | |
| - build-wasi | |
| if: always() | |
| steps: | |
| - name: Check whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe | |
| with: | |
| allowed-skips: >- | |
| ${{ | |
| needs.build-context.outputs.run-tests != 'true' | |
| && ' | |
| check-autoconf-regen, | |
| check-generated-files, | |
| build-wasi, | |
| ' | |
| || '' | |
| }} | |
| ${{ | |
| !fromJSON(needs.build-context.outputs.run-windows-tests) | |
| && ' | |
| build-windows, | |
| ' | |
| || '' | |
| }} | |
| jobs: ${{ toJSON(needs) }} |