|
| 1 | +name: Continuous Integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - "*" |
| 9 | + pull_request: |
| 10 | + schedule: |
| 11 | + - cron: '30 2 * * 1,4' # Every Monday and Thursday @ 2h30am UTC |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + os: ["ubuntu-22.04"] |
| 21 | + python-version: ["3.11", "3.12", "3.13"] |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v6 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + |
| 29 | + - name: Checkout source |
| 30 | + uses: actions/checkout@v5 |
| 31 | + with: |
| 32 | + fetch-depth: 1 |
| 33 | + |
| 34 | + - name: Create virtual environment |
| 35 | + run: | |
| 36 | + python -m venv .venv |
| 37 | + source .venv/bin/activate |
| 38 | + pip install -U pip |
| 39 | +
|
| 40 | + - name: Install saopicc-schemas |
| 41 | + run: | |
| 42 | + source .venv/bin/activate |
| 43 | + pip install .[testing] |
| 44 | +
|
| 45 | + - name: Test saopicc-schemas |
| 46 | + run: | |
| 47 | + source .venv/bin/activate |
| 48 | + py.test -s -vvv tests/ -Werror |
| 49 | +
|
| 50 | + # - name: Debug with tmate on failure |
| 51 | + # if: ${{ failure() }} |
| 52 | + # uses: mxschmitt/action-tmate@v3 |
| 53 | + |
| 54 | + deploy: |
| 55 | + needs: [test] |
| 56 | + runs-on: ubuntu-latest |
| 57 | + environment: |
| 58 | + name: pypi |
| 59 | + url: https:/pypi.org/p/saopicc-schemas |
| 60 | + permissions: |
| 61 | + id-token: write |
| 62 | + steps: |
| 63 | + - name: Set up Python 3.12 |
| 64 | + uses: actions/setup-python@v6 |
| 65 | + with: |
| 66 | + python-version: 3.12 |
| 67 | + |
| 68 | + - name: Checkout source |
| 69 | + uses: actions/checkout@v5 |
| 70 | + with: |
| 71 | + fetch-depth: 1 |
| 72 | + |
| 73 | + - name: Build distributions |
| 74 | + run: | |
| 75 | + pip install -U pip build |
| 76 | + python -m build --sdist --wheel |
| 77 | +
|
| 78 | + - name: Publish distribution 📦 to PyPI |
| 79 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 80 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments