-
Notifications
You must be signed in to change notification settings - Fork 563
131 lines (127 loc) · 3.78 KB
/
build-db.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
name: Builds and publishes the fiftyone-db package
on:
push:
tags:
- db-v[0-9]+.[0-9]+.[0-9]+
- db-v[0-9]+.[0-9]+.[0-9]+rc[0-9]+
pull_request:
paths:
- package/db/**
- .github/workflows/build-db.yml
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- sdist
- darwin-arm64
- darwin-x86_64
- windows-32
- windows-x86_64
steps:
- name: Clone fiftyone
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel build
- name: Set environment
env:
RELEASE_TAG: ${{ github.ref }}
run: |
if [[ $RELEASE_TAG =~ ^refs\/tags\/db-v[0-9]+.[0-9]+.[0-9]+rc[0-9]+ ]]; then
echo "RELEASE_VERSION=$(echo "${{ github.ref }}" | sed "s/^refs\/tags\/db-v//")" >> $GITHUB_ENV
fi
- name: Build Darwin arm64 wheel
if: ${{ matrix.platform == 'darwin-arm64' }}
run: |
cd package/db
FODB_MACHINE=arm64 FODB_SYSTEM=Darwin python -Im build
- name: Build Darwin x86_64 wheel
if: ${{ matrix.platform == 'darwin-x86_64' }}
run: |
cd package/db
FODB_MACHINE=x86_64 FODB_SYSTEM=Darwin python -Im build
- name: Build Windows 32 wheel
if: ${{ matrix.platform == 'windows-32' }}
run: |
cd package/db
FODB_MACHINE=32 FODB_SYSTEM=Windows python -Im build
- name: Build Windows x86_64 wheel
if: ${{ matrix.platform == 'windows-x86_64' }}
run: |
cd package/db
FODB_MACHINE=x86_64 FODB_SYSTEM=Windows python -Im build
- name: Build sdist
if: ${{ matrix.platform == 'sdist' }}
run: |
cd package/db
python -Im build --sdist
- name: Upload
uses: actions/upload-artifact@v4
if: ${{ matrix.platform == 'sdist' }}
with:
name: dist-${{ matrix.platform }}
path: package/db/dist/*.tar.gz
- name: Upload wheel
if: ${{ matrix.platform != 'sdist' }}
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.platform }}
path: package/db/dist/*.whl
test:
runs-on: ubuntu-latest
needs: build
env:
FIFTYONE_DO_NOT_TRACK: true
steps:
- name: Clone fiftyone
uses: actions/checkout@v4
- name: Download fiftyone-db
uses: actions/download-artifact@v4
with:
name: dist-sdist
path: downloads
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install fiftyone-db
run: |
pip install downloads/fiftyone_db-*.tar.gz
- name: Install test dependencies
run: |
pip install pytest
- name: Run tests
run: |
cd package/db/
python -m pytest --verbose tests/
publish:
runs-on: ubuntu-latest
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/db-v')
steps:
- name: Download
uses: actions/download-artifact@v4
with:
path: downloads
- name: Install dependencies
run: |
pip 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: |
python -m twine upload downloads/dist-*/*