Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Unittests & Auto-publish

# Allow to trigger the workflow manually (e.g. when deps changes)
on: [push, workflow_dispatch]

jobs:
unittest-job:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
runs-on: ubuntu-latest
timeout-minutes: 30

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3

# Install deps
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip --version
- run: pip install -e .
- run: pip freeze

# Run tests
- name: Run core tests
run: python -m unittest discover --pattern "*_test.py" --start-directory "pathwaysutils/test"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this call into absl test? Asking since it's using unittest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abseil/abseil-py#138

abseil doesn't have special logic for test discovery. Since absl.testing.absltest is built on top of unittest, if you just use absl.testing.absltest.TestCase over unittest.TestCase in your code, python -m unittest would also work.

Apparently fails if we are making use of some absl flags which we are not doing.


# Auto-publish when version is increased
publish-job:
# Only try to publish if:
# * Repo is self (prevents running from forks)
# * Branch is `main`
if: |
github.repository == 'google/etils'
&& github.ref == 'refs/heads/main'
needs: unittest-job # Only publish after tests are successful
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 30

steps:
# Publish the package (if local `__version__` > pip version)
- uses: etils-actions/pypi-auto-publish@v1
with:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
gh-token: ${{ secrets.GH_TOKEN }}
parse-changelog: true
Loading