|
| 1 | +name: "macOS CI pipeline setup steps" |
| 2 | +description: "Common setup steps for macOS CI pipelines" |
| 3 | + |
| 4 | +inputs: |
| 5 | + platform_machine: |
| 6 | + required: false |
| 7 | + type: string |
| 8 | + default: "arm64" |
| 9 | + python_version: |
| 10 | + required: false |
| 11 | + type: string |
| 12 | + default: "3.11" |
| 13 | + node_version: |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + default: "20.x" |
| 17 | + java_version: |
| 18 | + required: false |
| 19 | + type: string |
| 20 | + default: "17" |
| 21 | + xcode_version: |
| 22 | + required: false |
| 23 | + type: string |
| 24 | + default: "16" |
| 25 | + use_cache: |
| 26 | + required: false |
| 27 | + type: boolean |
| 28 | + default: false |
| 29 | + |
| 30 | +runs: |
| 31 | + using: "composite" |
| 32 | + steps: |
| 33 | + - name: Use Python |
| 34 | + uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: ${{ inputs.python_version }} |
| 37 | + |
| 38 | + - name: Verify machine architecture |
| 39 | + shell: python |
| 40 | + run: | |
| 41 | + import platform |
| 42 | + print(f"Running on {platform.machine()}") |
| 43 | + assert platform.machine().lower() == "${{ inputs.platform_machine}}", "This job expects to be run on an ${{ inputs.platform_machine}} machine." |
| 44 | +
|
| 45 | + - name: Use Node.js |
| 46 | + uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version: ${{ inputs.node_version }} |
| 49 | + |
| 50 | + - name: Install coreutils and ninja |
| 51 | + shell: bash |
| 52 | + run: brew install coreutils ninja |
| 53 | + |
| 54 | + - name: Install Java |
| 55 | + uses: actions/setup-java@v4 |
| 56 | + with: |
| 57 | + distribution: "temurin" |
| 58 | + java-version: ${{ inputs.java_version }} |
| 59 | + |
| 60 | + - name: Use Xcode ${{ inputs.xcode_version }} |
| 61 | + shell: bash |
| 62 | + run: | |
| 63 | + XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ inputs.xcode_version }}.app/Contents/Developer" |
| 64 | + sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}" |
| 65 | +
|
| 66 | + - name: Export GitHub Actions cache environment variables |
| 67 | + if: ${{ inputs.use_cache }} |
| 68 | + uses: actions/github-script@v7 |
| 69 | + with: |
| 70 | + script: | |
| 71 | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
| 72 | + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
| 73 | +
|
| 74 | + - name: Install python dependencies |
| 75 | + shell: bash |
| 76 | + working-directory: ${{ github.workspace }} |
| 77 | + run: | |
| 78 | + python -m pip install --upgrade pip |
| 79 | + python -m pip install -r requirements-dev.txt |
0 commit comments