Skip to content

order imports and modify style guide #353

order imports and modify style guide

order imports and modify style guide #353

Workflow file for this run

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
with:
name: dist-${{ matrix.platform }}
path: package/db/dist/*
test:
runs-on: ubuntu-20.04
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: Install fiftyone-db
run: |
pip3 install downloads/fiftyone_db-*.tar.gz
- name: Install test dependencies
run: |
pip3 install pytest
- name: Run tests
run: |
cd package/db/
python3 -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-*/*