Separate upload for windows and not windows #67
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: false # TODO(LM): Set to true | |
RUN_ID: 10824742361 # 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: true | |
matrix: | |
os: ["ubuntu-22.04", "windows-2022", "macos-14"] | |
include: | |
- os-folder: linux-64 | |
- build-folder: .conda.tensorflow | |
- os: "windows-2022" | |
os-folder: win-64 | |
env-prefix: C:\c\ | |
- 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: Make conda prefix directory (Windows) | |
if: matrix.os == 'windows-2022' | |
shell: powershell | |
run: | | |
New-Item -ItemType Directory -Force -Path ${{ matrix.env-prefix }} | |
- name: Setup Miniconda | |
if: env.RUN_BUILD_JOB == 'true' | |
uses: conda-incubator/setup-miniconda@v3.0.3 | |
with: | |
python-version: "3.10" | |
environment-file: environment.tensorflow.yml | |
activate-environment: ${{ matrix.env-prefix }}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 (Windows) | |
if: (runner.os == 'Windows') && (env.RUN_BUILD_JOB == 'true') | |
shell: powershell | |
run: | | |
conda build --debug ${{ matrix.build-folder }} --output-folder ${{ matrix.env-prefix }}build -c conda-forge | |
- name: Build conda package (not Windows) | |
if: (runner.os != 'Windows') && (env.RUN_BUILD_JOB == 'true') | |
shell: bash -l {0} | |
run: | | |
conda build --debug ${{ matrix.build-folder }} --output-folder build -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: ${{ matrix.env-prefix }}build # 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: | |
# Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3.0.3 | |
with: | |
python-version: "3.10" | |
environment-file: environment.tensorflow.yml | |
activate-environment: tf | |
- 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: tensorflow-build-${{ matrix.os-folder }} | |
path: build | |
run-id: ${{ env.RUN_ID }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: List items in current directory | |
shell: bash -l {0} | |
run: | | |
ls . | |
ls -R build | |
- name: Upload to Anaconda (Windows) | |
if: runner.os == 'Windows' | |
env: | |
ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD }} | |
shell: bash -l {0} | |
run: | | |
anaconda login --username sleap-deps --password "$ANACONDA_PASSWORD" | |
anaconda -v upload "build/${{ matrix.os-folder }}/*.tar.bz2" --label dev --user sleap-deps | |
anaconda logout | |
- name: Upload to Anaconda (not Windows) | |
if: runner.os != 'Windows' | |
env: | |
ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD }} | |
shell: bash -l {0} | |
run: | | |
anaconda login --username sleap-deps --password "$ANACONDA_PASSWORD" | |
anaconda -v upload build/${{ matrix.os-folder }}/*.tar.bz2 --label dev --user sleap-deps | |
anaconda logout |