Use powershell to build Windows packages #52
Workflow file for this run
This file contains 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: Build TensorFlow | |
on: | |
push: | |
branches: | |
- main | |
- elizabeth/add-windows-linux-tensorflow-conda-package | |
paths: | |
- ".github/workflows/build_tensorflow.yml" | |
- ".conda.tensorflow/**" | |
- ".conda.tensorflow_macos/**" | |
- "environment.tensorflow.yml" | |
- "requirements.tensorflow.txt" | |
- "requirements.tensorflow_macos.txt" | |
# If RUN_BUILD_JOB is set to true, then RUN_ID will be overwritten to the current run id | |
env: | |
RUN_BUILD_JOB: true | |
RUN_ID: 10713717594 # Only used if RUN_BUILD_JOB is false (to dowload build artifact) | |
jobs: | |
build: | |
name: Build package (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false # TODO(LM): Set to true | |
matrix: | |
os: ["ubuntu-22.04", "windows-2022", "macos-14"] | |
include: | |
- os-folder: win-64 | |
- build-folder: .conda.tensorflow | |
- os: "ubuntu-22.04" | |
os-folder: linux-64 | |
- os: "macos-14" | |
os-folder: osx-arm64 | |
build-folder: .conda.tensorflow_macos | |
steps: | |
# Checkout the repository | |
- name: Checkout | |
if: env.RUN_BUILD_JOB == 'true' | |
uses: actions/checkout@v4 | |
- name: Setup Miniconda | |
if: env.RUN_BUILD_JOB == 'true' | |
uses: conda-incubator/[email protected] | |
with: | |
python-version: "3.10" | |
environment-file: environment.tensorflow.yml | |
activate-environment: tf | |
- name: Print environment info | |
if: env.RUN_BUILD_JOB == 'true' | |
shell: bash -l {0} | |
run: | | |
which python | |
conda info | |
conda list | |
- name: Build conda package (${{ matrix.os }}) | |
if: (${{ runner.os }} == 'Windows' ) && (env.RUN_BUILD_JOB == 'true') | |
shell: powershell | |
run: | | |
conda build --debug ${{ matrix.build-folder }} --output-folder build.tensorflow -c conda-forge | |
- name: Build conda package (${{ matrix.os }}) | |
if: (${{ runner.os }} != 'Windows' ) && (env.RUN_BUILD_JOB == 'true') | |
shell: bash -l {0} | |
run: | | |
conda build --debug ${{ matrix.build-folder }} --output-folder build.tensorflow -c conda-forge | |
# Upload the build artifact incase anaconda upload fails | |
- name: Upload conda package artifact | |
if: env.RUN_BUILD_JOB == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tensorflow-build-${{ matrix.os-folder }} | |
path: build.tensorflow # Upload entire build directory | |
retention-days: 1 | |
upload: | |
name: Upload package (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
needs: build | |
strategy: | |
fail-fast: false # TODO(LM): Set to true | |
matrix: | |
os: ["ubuntu-22.04", "windows-2022", "macos-14"] | |
include: | |
- os-folder: win-64 | |
- os: "ubuntu-22.04" | |
os-folder: linux-64 | |
- os: "macos-14" | |
os-folder: osx-arm64 | |
steps: | |
- name: Use current run id for conda package download | |
shell: bash -l {0} | |
if: env.RUN_BUILD_JOB == 'true' | |
run: echo "RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV | |
# https://github.com/actions/download-artifact?tab=readme-ov-file#usage | |
- name: Download conda package artifact | |
uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: sleap-build-${{ matrix.os-folder }} | |
path: build.tensorflow | |
run-id: ${{ env.RUN_ID }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Setup Miniconda | |
if: env.RUN_BUILD_JOB == 'true' | |
uses: conda-incubator/[email protected] | |
with: | |
python-version: "3.10" | |
environment-file: environment.tensorflow.yml | |
activate-environment: tf | |
- name: Upload to Anaconda | |
if: env.RUN_BUILD_JOB == 'true' | |
env: | |
ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD }} | |
shell: bash -l {0} | |
run: | | |
anaconda login --username sleap-deps --password "$ANACONDA_PASSWORD" | |
anaconda -v upload build.tensorflow/${{ matrix.os-folder }}/*.tar.bz2 --label dev --user sleap-deps | |
anaconda logout |