Skip to content

Merge pull request #2 from talmolab/elizabeth/Change-Tensorflow-version #33

Merge pull request #2 from talmolab/elizabeth/Change-Tensorflow-version

Merge pull request #2 from talmolab/elizabeth/Change-Tensorflow-version #33

name: Build TensorFlow
on:
push:
branches:
- main
paths:
- '.github/workflows/build_tensorflow.yml'
- '.conda.tensorflow/**'
- 'environment.tensorflow.yml'
- 'requirements.tensorflow.txt'
jobs:
build:
name: Build package (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "windows-2022"]
steps:
# Setup
- uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if environment_build.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.tensorflow.yml', 'requirements.tensorflow.txt') }}
- name: Setup Miniconda
# https://github.com/conda-incubator/setup-miniconda
uses: conda-incubator/[email protected]
with:
python-version: 3.7
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
environment-file: environment.tensorflow.yml
activate-environment: build_tensorflow
- name: Print environment info
shell: bash -l {0}
run: |
which python
conda info
# Build conda package
- name: Build conda package (Windows)
if: matrix.os == 'windows-2022'
shell: powershell
run: |
conda activate build_tensorflow
conda build .conda.tensorflow --output-folder build.tensorflow -c conda-forge
- name: Build conda package (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash -l {0}
run: |
conda build .conda.tensorflow --output-folder build.tensorflow -c conda-forge
# Upload conda package
- name: Upload to Anaconda (Windows)
if: matrix.os == 'windows-2022'
env:
ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
shell: powershell
run: |
anaconda login --username sleap --password "$env:ANACONDA_LOGIN"
anaconda -v upload "build.tensorflow\win-64\*.tar.bz2" --label dev
anaconda logout
- name: Upload to Anaconda (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
env:
ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
shell: bash -l {0}
run: |
anaconda login --username sleap --password "$ANACONDA_LOGIN"
anaconda -v upload build.tensorflow/linux-64/*.tar.bz2 --label dev
anaconda logout