Feat/use forecasting endpoint hems #955
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: tests | |
| on: | |
| push: | |
| # Avoid using all the resources/limits available by checking only | |
| # relevant branches and tags. Other branches can be checked via PRs. | |
| branches: [main] | |
| tags: | |
| - 'v[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+' # Match tags that resemble a version | |
| - 'v[0-9]+\.[0-9]+\.[0-9]+' # Match tags that resemble a version | |
| pull_request: # Run in every PR | |
| workflow_dispatch: # Allow manually triggering the workflow | |
| schedule: | |
| # Run roughly every 15 days at 00:00 UTC | |
| # (useful to check if updates on dependencies break the package) | |
| - cron: "0 0 1,16 * *" | |
| concurrency: | |
| group: >- | |
| ${{ github.workflow }}-${{ github.ref_type }}- | |
| ${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| wheel-distribution: ${{ steps.wheel-distribution.outputs.path }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: { fetch-depth: 0 } # deep clone for setuptools-scm | |
| - uses: actions/setup-python@v4 | |
| id: setup-python | |
| with: { python-version: "3.11" } | |
| - name: Run static analysis and format checkers | |
| run: pipx run pre-commit run --all-files --show-diff-on-failure | |
| - name: Build package distribution files | |
| run: >- | |
| pipx run --python '${{ steps.setup-python.outputs.python-path }}' | |
| tox -e clean,build | |
| - name: Record the path of wheel distribution | |
| id: wheel-distribution | |
| run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT | |
| - name: Store the distribution files for use in other stages | |
| # `tests` and `publish` will use the same pre-built distributions, | |
| # so we make sure to release the exact same package that was tested | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-distribution-files | |
| path: dist/ | |
| retention-days: 1 | |
| test: | |
| needs: prepare | |
| strategy: | |
| matrix: | |
| python: | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| platform: | |
| - ubuntu-latest | |
| - macos-latest | |
| # - windows-latest | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v4 | |
| id: setup-python | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Retrieve pre-built distribution files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-distribution-files | |
| path: dist/ | |
| - name: Run tests | |
| run: >- | |
| pipx run --python '${{ steps.setup-python.outputs.python-path }}' | |
| tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}' | |
| -- -rFEx --durations 10 --color yes # pytest args | |
| - name: Run tests (s2) | |
| run: >- | |
| pipx run --python '${{ steps.setup-python.outputs.python-path }}' | |
| tox -e s2 --installpkg '${{ needs.prepare.outputs.wheel-distribution }}' | |
| -- -rFEx --durations 10 --color yes # pytest args | |
| - name: Show coverage report | |
| run: pipx run coverage report | |
| - name: Generate coverage report | |
| run: pipx run coverage lcov -o coverage.lcov | |
| - name: Upload partial coverage report | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| fail-on-error: false | |
| path-to-lcov: coverage.lcov | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| flag-name: ${{ matrix.platform }} - py${{ matrix.python }} | |
| parallel: true | |
| finalize: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Coveralls Finished | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| fail-on-error: false | |
| parallel-finished: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - run: echo "Finished checks" | |
| publish: | |
| needs: finalize | |
| if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/v') }} | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: release | |
| url: https://pypi.org/project/flexmeasures-client/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: {fetch-depth: 0} # deep clone for setuptools-scm | |
| - uses: actions/setup-python@v4 | |
| with: { python-version: "3.11" } | |
| - name: Retrieve pre-built distribution files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-distribution-files | |
| path: dist/ | |
| - name: Publish Package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # run: pipx run tox -e publish | |
| - name: Publish release on GitHub | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| tag_name: ${{ inputs.custom_version || github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }} | |
| # test-publish: | |
| # needs: finalize | |
| # if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/test') }} | |
| # runs-on: ubuntu-latest | |
| # environment: | |
| # name: testpypi | |
| # url: https://test.pypi.org/project/flexmeasures-client/ | |
| # permissions: | |
| # id-token: write | |
| # steps: | |
| # - uses: actions/checkout@v3 | |
| # - uses: actions/setup-python@v4 | |
| # with: {python-version: "3.11"} | |
| # - name: Retrieve pre-built distribution files | |
| # uses: actions/download-artifact@v3 | |
| # with: {name: python-distribution-files, path: dist/} | |
| # - name: Publish Package | |
| # uses: pypa/gh-action-pypi-publish@release/v1 | |
| # with: | |
| # repository-url: https://test.pypi.org/legacy/ | |
| # # run: pipx run tox -e publish |