Skip to content

Better error message when flag parsing fail #21

Better error message when flag parsing fail

Better error message when flag parsing fail #21

name: Unittests & Auto-publish
# Allow to trigger the workflow manually (e.g. when deps changes)
on: [push, workflow_dispatch]
jobs:
pytest-job:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
timeout-minutes: 30
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
# Install deps
- uses: actions/setup-python@v5
with:
python-version: "3.10"
# Uncomment to cache of pip dependencies (if tests too slow)
# cache: pip
# cache-dependency-path: '**/pyproject.toml'
- run: pip --version
- run: pip install -e .[dev]
- run: pip freeze
# Run tests (in parallel)
- name: Run core tests
run: |
# TODO(marcenacp): do not ignore tests.
pytest -vv -n auto ml_collections/ \
--ignore=ml_collections/config_dict/examples/examples_test.py
# Auto-publish when version is increased
publish-job:
# Only try to publish if:
# * Repo is self (prevents running from forks)
# * Branch is `master`
if: |
github.repository == 'google/ml_collections'
&& github.ref == 'refs/heads/master'
needs: pytest-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.GITHUB_TOKEN }}