Skip to content

Commit

Permalink
Combine workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed May 5, 2023
1 parent fb9b1be commit 59e86f8
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 204 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/python-publish-gpu.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,43 @@ jobs:
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true

build-n-publish-gpu:
if: startsWith(github.ref, 'refs/tags/')

name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Set preferred device to GPU
run: >-
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
153 changes: 0 additions & 153 deletions .github/workflows/release-gpu.yml

This file was deleted.

95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,98 @@ jobs:
asset_name: AnyLabeling.dmg
asset_content_type: application/octet-stream
if: runner.os == 'macOS'

publish-gpu:
needs: [release]

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: '3.7'

- name: Set preferred device to GPU
shell: bash -l {0}
run: >-
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py
- name: Install main
shell: bash -l {0}
run: |
pip install .
- name: Install PyQt5 for macOS
shell: bash -l {0}
run: |
conda install -c conda-forge pyqt==5.15.7
if: runner.os == 'macOS'

- name: Run pyinstaller
shell: bash -l {0}
run: |
pip install pyinstaller
pyinstaller anylabeling.spec
- name: Load release url file from release job
uses: actions/download-artifact@v1
with:
name: release_url

- name: Get release file name & upload url
id: get_release_info
run: |
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
- name: Upload release executable on macOS & Linux
id: upload_release_executable_macos_linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/anylabeling
asset_name: AnyLabeling-${{ runner.os }}-GPU
asset_content_type: application/octet-stream
if: runner.os != 'Windows'

- name: Upload release executable on Windows
id: upload_release_executable_windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/anylabeling.exe
asset_name: AnyLabeling-GPU.exe
asset_content_type: application/octet-stream
if: runner.os == 'Windows'

- name: Create dmg for macOS
run: |
npm install -g create-dmg
cd dist
create-dmg AnyLabeling.app || test -f AnyLabeling\ 0.0.0.dmg
mv AnyLabeling\ 0.0.0.dmg AnyLabeling.dmg
if: runner.os == 'macOS'

- name: Upload release app on macOS
id: upload_release_app_macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/AnyLabeling.dmg
asset_name: AnyLabeling-GPU.dmg
asset_content_type: application/octet-stream
if: runner.os == 'macOS'
2 changes: 1 addition & 1 deletion anylabeling/app_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__appname__ = "AnyLabeling"
__appdescription__ = "Effortless data labeling with AI support"
__version__ = "0.2.20"
__version__ = "0.2.21"
__preferred_device__ = "CPU" # GPU or CPU

0 comments on commit 59e86f8

Please sign in to comment.