# @generated DO NOT EDIT MANUALLY
# Template is at:    .github/templates/macos_ci_workflow.yml.j2
# Generation script: .github/scripts/generate_ci_workflows.py
name: macos-10-15-py3-lite-interpreter-x86-64

on:
  push:
    branches:
      - master
      - release/*
    tags:
      - 'ciflow/all/*'
      - 'ciflow/macos/*'
      - 'ciflow/trunk/*'
  workflow_dispatch:

# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179
defaults:
  run:
    shell: bash -e -l {0}
env:
  BUILD_ENVIRONMENT: macos-10-15-py3-lite-interpreter-x86-64
  COMPACT_JOB_NAME: macos-10-15-py3-lite-interpreter-x86-64
  IN_CI: 1
  IS_GHA: 1
  PYTORCH_RETRY_TEST_CASES: 1

  # Set xcode xcode version to 12
  DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer

jobs:

  build:
    runs-on: macos-10.15
    env:
      JOB_BASE_NAME: macos-10-15-py3-lite-interpreter-x86-64
      # For sccache access (only on non-forked PRs)
      AWS_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }}
      PR_LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
    steps:
      - name: print labels
        run: echo "${PR_LABELS}"
      - name: Checkout PyTorch
        uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
        with:
          # deep clone, to allow use of git merge-base
          fetch-depth: 0
          submodules: recursive
      - name: Clean PyTorch checkout
        run: |
          # Remove any artifacts from the previous checkouts
          git clean -fxd
      - name: Setup miniconda
        uses: conda-incubator/setup-miniconda@v2
        with:
          auto-update-conda: true
          python-version: 3.8
          activate-environment: build
      - name: Install macOS homebrew dependencies
        run: |
          # Install dependencies
          brew install libomp
      - name: Install sccache (only for non-forked PRs, and pushes to trunk)
        if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
        run: |
          sudo curl --retry 3 https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache
          sudo chmod +x /usr/local/bin/sccache
          echo "SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2" >> "${GITHUB_ENV}"
      - name: Build
        run: |
          echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"}" >> "${GITHUB_ENV}"
          .jenkins/pytorch/macos-build.sh


concurrency:
  group: macos-10-15-py3-lite-interpreter-x86-64-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
  cancel-in-progress: true
