summaryrefslogtreecommitdiffstats
path: root/.github/workflows/reusable-macos.yml
blob: acaab45e5b5e12d43fc2509abd68906e2bce1ea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Reusable macOS

on:
  workflow_call:
    inputs:
      config_hash:
        required: true
        type: string
      free-threading:
        required: false
        type: boolean
        default: false
      os:
        description: OS to run the job
        required: true
        type: string

jobs:
  build_macos:
    name: build and test (${{ inputs.os }})
    timeout-minutes: 60
    env:
      HOMEBREW_NO_ANALYTICS: 1
      HOMEBREW_NO_AUTO_UPDATE: 1
      HOMEBREW_NO_INSTALL_CLEANUP: 1
      HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
      PYTHONSTRICTEXTENSIONBUILD: 1
    runs-on: ${{ inputs.os }}
    steps:
    - uses: actions/checkout@v4
    - name: Runner image version
      run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
    - name: Restore config.cache
      uses: actions/cache@v4
      with:
        path: config.cache
        key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
    - name: Install Homebrew dependencies
      run: |
        brew install pkg-config openssl@3.0 xz gdbm tcl-tk@8
        # Because alternate versions are not symlinked into place by default:
        brew link tcl-tk@8
    - name: Configure CPython
      run: |
        GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
        GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
        ./configure \
          --config-cache \
          --with-pydebug \
          ${{ inputs.free-threading && '--disable-gil' || '' }} \
          --prefix=/opt/python-dev \
          --with-openssl="$(brew --prefix openssl@3.0)"
    - name: Build CPython
      run: make -j4
    - name: Display build info
      run: make pythoninfo
    - name: Tests
      run: make buildbottest TESTOPTS="-j4 -uall,-cpu"