-
Notifications
You must be signed in to change notification settings - Fork 8
144 lines (140 loc) · 4.39 KB
/
build.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
137
138
139
140
141
142
143
144
name: Build
on:
pull_request:
branches:
- develop
types: [opened, synchronize]
push:
branches:
- develop
tags:
- v*
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Clone fiftyone-brain
uses: actions/checkout@v1
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Check Python version
run: |
python --version
pip --version
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements/build.txt
- name: Set environment
env:
RELEASE_TAG: ${{ github.ref }}
run: |
if [[ $RELEASE_TAG =~ ^refs\/tags\/v.* ]]; then
echo "RELEASE_VERSION=$(echo '${{ github.ref }}' | sed 's/^refs\/tags\/v//')" >> $GITHUB_ENV
fi
- name: Build wheel
run: |
python setup.py sdist bdist_wheel
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
path: dist
retention-days: 1
test:
needs: [build]
runs-on: ubuntu-20.04
env:
FIFTYONE_DATASET_ZOO_DIR: ${{ github.workspace }}/.fiftyone
FIFTYONE_DO_NOT_TRACK: true
FIFTYONE_MODEL_ZOO_DIR: ${{ github.workspace }}/.fiftyone
strategy:
fail-fast: false
matrix:
python:
- "3.9"
- "3.10"
- "3.11"
steps:
- name: Clone fiftyone-brain
uses: actions/checkout@v1
with:
submodules: true
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
- name: Download fiftyone-brain wheel
uses: actions/download-artifact@v4
with:
path: dist
- name: Install fiftyone
run: |
git clone https://${{ secrets.FIFTYONE_GITHUB_TOKEN }}@github.com/voxel51/fiftyone fiftyone-src --depth 1 --branch develop
cd fiftyone-src
python setup.py bdist_wheel
pip install voxel51-eta[storage] fiftyone-db
pip install ./dist/*.whl
- name: Install ETA from source
if: ${{ !startsWith(github.ref, 'refs/heads/rel') && !startsWith(github.ref, 'refs/tags/') }}
run: |
echo "Installing ETA from source because github.ref = ${{ github.ref }} (not a release)"
git clone https://github.com/voxel51/eta eta --depth 1 --branch develop
cd eta
python setup.py bdist_wheel
pip install ./dist/*.whl --force-reinstall
- name: Reinstall fiftyone-brain
run: |
pip install --force-reinstall --no-deps dist/artifact/*.whl
- name: Set up ETA credentials
env:
FIFTYONE_GOOGLE_CREDENTIALS: ${{ secrets.FIFTYONE_GOOGLE_CREDENTIALS }}
run: |
mkdir -p "${HOME}/.eta"
echo "$FIFTYONE_GOOGLE_CREDENTIALS" > "${HOME}/.eta/google-credentials.json"
wc "${HOME}/.eta/google-credentials.json"
md5sum "${HOME}/.eta/google-credentials.json"
- name: Install test dependencies
run: |
pip install imageio pytest torch torchvision
- name: Cache Zoo
id: fiftyone-cache
uses: actions/cache@v4
with:
path: |
.fiftyone
key: zoo-${{ hashFiles('tests/**') }}
- name: Run tests
run: |
pytest --verbose tests/ --ignore tests/intensive/
publish:
needs: [build]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-20.04
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
path: dist
- name: Install dependencies
run: |
pip3 install --upgrade importlib-metadata pip setuptools wheel typing-extensions
pip3 install twine
- name: Set environment
env:
RELEASE_TAG: ${{ github.ref }}
run: |
echo "TWINE_PASSWORD=${{ secrets.FIFTYONE_PYPI_TOKEN }}" >> $GITHUB_ENV
echo "TWINE_REPOSITORY=pypi" >> $GITHUB_ENV
- name: Upload to pypi
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
run: |
python3 -m twine upload dist/artifact/*