-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (121 loc) · 4.28 KB
/
build_tensorflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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: linux-64
- build-folder: .conda.tensorflow
- os-shell: bash -l {0}
- os: "windows-2022"
os-folder: win-64
os-shell: powershell
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/[email protected]
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
if: env.RUN_BUILD_JOB == 'true'
shell: matrix.os-shell
run: |
conda build --debug ${{ matrix.build-folder }} --output-folder ${{ matrix.env-prefix }}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: ${{ matrix.env-prefix }}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