|
| 1 | +name: Test-ubuntu-nightly |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + test: |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + timeout-minutes: 30 |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + # test for: |
| 13 | + # * oldest supported version |
| 14 | + # * latest available Python version |
| 15 | + python-version: ['3.10', '3.14'] |
| 16 | + # * Linux using ubuntu-latest |
| 17 | + os: ['ubuntu-latest'] |
| 18 | + # * OM nightly - latest nightly build |
| 19 | + omc-version: ['nightly'] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v6 |
| 23 | + |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v6 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + architecture: 'x64' |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip build setuptools wheel twine |
| 33 | + pip install . pytest pytest-md pytest-emoji pre-commit |
| 34 | +
|
| 35 | + - name: Set timezone |
| 36 | + uses: szenius/set-timezone@v2.0 |
| 37 | + with: |
| 38 | + timezoneLinux: 'Europe/Berlin' |
| 39 | + |
| 40 | + - name: Run pre-commit linters |
| 41 | + run: 'pre-commit run --all-files' |
| 42 | + |
| 43 | + - name: "Set up OpenModelica Compiler" |
| 44 | + uses: OpenModelica/setup-openmodelica@v1.0.6 |
| 45 | + with: |
| 46 | + version: ${{ matrix.omc-version }} |
| 47 | + packages: | |
| 48 | + omc |
| 49 | + libraries: | |
| 50 | + 'Modelica 4.0.0' |
| 51 | + - run: "omc --version" |
| 52 | + |
| 53 | + - name: Pull OpenModelica docker image |
| 54 | + if: runner.os != 'Windows' |
| 55 | + run: docker pull openmodelica/openmodelica:v1.25.0-minimal |
| 56 | + |
| 57 | + - name: Build wheel and sdist packages |
| 58 | + run: python -m build --wheel --sdist --outdir dist |
| 59 | + |
| 60 | + - name: Check twine |
| 61 | + run: python -m twine check dist/* |
| 62 | + |
| 63 | + - name: Run pytest |
| 64 | + uses: pavelzw/pytest-action@v2 |
| 65 | + with: |
| 66 | + verbose: true |
| 67 | + emoji: true |
| 68 | + job-summary: true |
| 69 | + custom-arguments: '-v' |
| 70 | + click-to-expand: true |
| 71 | + report-title: 'Test Report' |
| 72 | + |
| 73 | + Publish: |
| 74 | + name: Publish to PyPI |
| 75 | + runs-on: ${{ matrix.os }} |
| 76 | + needs: test |
| 77 | + strategy: |
| 78 | + matrix: |
| 79 | + python-version: ['3.10'] |
| 80 | + os: ['ubuntu-latest'] |
| 81 | + if: startsWith(github.ref, 'refs/tags/') |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v6 |
| 84 | + |
| 85 | + - name: Set up Python ${{ matrix.python-version }} |
| 86 | + uses: actions/setup-python@v6 |
| 87 | + with: |
| 88 | + python-version: ${{ matrix.python-version }} |
| 89 | + architecture: 'x64' |
| 90 | + |
| 91 | + - name: Install dependencies |
| 92 | + run: | |
| 93 | + python -m pip install --upgrade pip build setuptools wheel twine |
| 94 | +
|
| 95 | + - name: Build wheel and sdist packages |
| 96 | + run: python -m build --wheel --sdist --outdir dist |
| 97 | + |
| 98 | + - name: Publish wheel and sdist packages to PyPI |
| 99 | + env: |
| 100 | + TWINE_USERNAME: __token__ |
| 101 | + TWINE_PASSWORD: ${{ secrets.PYPI_OMPYTHON_API_TOKEN }} |
| 102 | + run: | |
| 103 | + python -m twine upload dist/* --skip-existing |
0 commit comments