Skip to content

Commit

Permalink
Update and rename python-publish.yml to test_trajdl_vtag.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidham3 authored Dec 20, 2024
1 parent bc3c3bf commit 5bba45d
Showing 1 changed file with 30 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
name: Build and Publish
name: Test TrajDL on tag v

on:
workflow_run:
workflows: ["Building docs"]
types:
- completed
push:
tags:
- 'v*'

jobs:
build-and-publish:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4

- name: Install build-essential and make
run: |
Expand All @@ -38,6 +34,26 @@ jobs:
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python -m pip install .[dev,docs]
- name: Cache datasets
id: cache-datasets
uses: actions/cache@v3
with:
path: ~/.cache/trajdl
key: trajdl-cache-datasets

- name: Test with pytest
run: |
autoflake -j 0 --remove-all-unused-imports --in-place --recursive --ignore-init-module-imports .
isort -j -1 .
black .
pytest -s
- name: Build package
run: |
if [ "${{ matrix.python-version }}" = "3.12" ]; then
python -m build
fi
- name: Build package
run: |
if [ "${{ matrix.python-version }}" = "3.12" ]; then
Expand All @@ -49,31 +65,7 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.python-version }}
name: dist-${{ github.ref_name }}-${{ github.sha }}-${{ matrix.python-version }}
path: dist/
retention-days: 1
overwrite: true

publish:
needs: build-and-publish
runs-on: ubuntu-latest

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist

- name: Prepare distribution files
run: |
mkdir -p final_dist
cp -r dist/*/* final_dist/
ls final_dist
# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
# packages_dir: final_dist/
# skip_existing: true

0 comments on commit 5bba45d

Please sign in to comment.