Refactor code structure for improved readability and maintainability #78
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build_wheel: | |
| runs-on: [self-hosted, ubuntu-24.04, gaya] | |
| continue-on-error: true | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 1 | |
| matrix: | |
| os: [ubuntu-24.04] | |
| name: Build wheel package | |
| if: ${{ !contains(github.event.head_commit.message, 'skip wheel') }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| submodules: recursive | |
| clean: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install Python/Node Env | |
| run: | | |
| uv venv .venv-mo2fmu | |
| uv pip install --python .venv-mo2fmu -e ".[all]" | |
| npm install | |
| - name: Code Quality Checks | |
| run: | | |
| source .venv-mo2fmu/bin/activate | |
| ruff check src/python tests | |
| black --check src/python tests | |
| flake8 src/python tests | |
| mypy src/python | |
| - name: Build mo2fmu wheel | |
| run: | | |
| uv build | |
| - name: Python Tests | |
| run: | | |
| source .venv-mo2fmu/bin/activate | |
| pytest --cov=feelpp.mo2fmu --cov-report=term-missing --cov-report=xml | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| GIRDER_API_KEY: ${{ secrets.GIRDER }} | |
| DYMOLA_RUNTIME_LICENSE: "${{ secrets.DYMOLA_RUNTIME_LICENSE }}" | |
| DYMOLA_ROOT: /opt/dymola-2025xRefresh1-x86_64/ | |
| DYMOLA_EXECUTABLE: /usr/local/bin/dymola | |
| DYMOLA_WHL: Modelica/Library/python_interface/dymola-2025.1-py3-none-any.whl | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts-wheel-${{ matrix.os }} | |
| path: dist/*.whl | |
| build_docs: | |
| needs: build_wheel | |
| runs-on: [self-hosted, ubuntu-24.04, gaya] | |
| strategy: | |
| matrix: | |
| os: [ubuntu-24.04] | |
| name: Build & Deploy docs | |
| if: ${{ !contains(github.event.head_commit.message, 'skip docs') }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| submodules: recursive | |
| clean: true | |
| - name: Install credentials | |
| run: echo "https://$GITHUB_OAUTH:@github.com" > $HOME/.git-credentials | |
| env: | |
| GITHUB_OAUTH: ${{ secrets.CR_PAT_WORKFLOW }} | |
| - name: Download Wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: artifacts-wheel-${{ matrix.os }} | |
| path: dist/ | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install Python deps | |
| run: | | |
| uv venv .venv-mo2fmu | |
| uv pip install --python .venv-mo2fmu dist/*.whl | |
| - name: Build Antora site | |
| run: | | |
| source .venv-mo2fmu/bin/activate | |
| npm install | |
| npm run antora || true | |
| npm run antora | |
| env: | |
| GIRDER_API_KEY: ${{ secrets.GIRDER }} | |
| - name: Deploy to GitHub Pages | |
| if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-24.04' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: gh-pages | |
| folder: public | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: build_wheel | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| id-token: write | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/feelpp-mo2fmu | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download wheel artifact (Ubuntu 24.04) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: artifacts-wheel-ubuntu-24.04 | |
| path: ./dist/ | |
| - name: Create Release & Upload Wheel | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }} | |
| generate_release_notes: true | |
| files: | | |
| ./dist/*.whl | |
| LICENSE | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| verbose: true | |