-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a9f023
commit 8074c0d
Showing
5 changed files
with
171 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
## | ||
## Copyright (c) 2022-2023 Geosiris. | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
--- | ||
|
||
name: Prepare Python and Poetry | ||
Description: Install Python, Poetry and dev dependencies, cached for speed | ||
|
||
inputs: | ||
python-version: | ||
description: 'Python version to use' | ||
required: true | ||
default: '3.x' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up Python | ||
id: setup-python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Load cached Poetry installation | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.local # the path depends on the OS | ||
key: poetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-4 # increment to reset cache | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.5.1 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: false | ||
|
||
- name: Install Poetry Plugins | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry-dynamic-versioning | ||
shell: bash | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-1 | ||
|
||
- name: Install dependencies and library | ||
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction | ||
shell: bash | ||
|
||
- name: Install Poetry Plugins | ||
run: poetry self add "poetry-dynamic-versioning[plugin]" | ||
shell: bash |
This file contains 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
112 changes: 112 additions & 0 deletions
112
energyml-utils/.github/workflow/ci-energyml-utils-pull-request.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
## | ||
## Copyright (c) 2023-2024 Geosiris. | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
--- | ||
|
||
name: Publish (pypiTest) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install poetry | ||
uses: ../.github/actions/prepare-poetry | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Build | ||
run: | | ||
poetry install | ||
poetry self add "poetry-dynamic-versioning[plugin]" | ||
poetry build | ||
- name: Save build artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: dist-artifact | ||
path: dist/ | ||
|
||
test: | ||
name: Test | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist-artifact | ||
path: dist/ | ||
|
||
- name: Install from build | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest-mock | ||
pip install etpproto --pre --target=dist --find-links=dist/ | ||
- name: Copy tests and example data to dist folder for testing against artifacts | ||
run: | | ||
cp -R tests dist/ | ||
# cp -R example_data dist/ | ||
|
||
- name: Run tests | ||
run: pytest dist/tests | ||
|
||
publish: | ||
name: Publish to PyPI | ||
needs: [build, test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# Retrieve the code and GIT history so that poetry-dynamic-versioning knows which version to upload | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist-artifact | ||
path: dist/ | ||
|
||
- name: Install poetry | ||
uses: ../.github/actions/prepare-poetry | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Upload to PyPI TEST | ||
run: | | ||
poetry self add "poetry-dynamic-versioning[plugin]" | ||
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | ||
poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }} | ||
poetry publish --repository test-pypi |
File renamed without changes.
This file contains 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