-
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.
Merge pull request #7 from mgvalverde/workflows
chore: add workflows
- Loading branch information
Showing
4 changed files
with
314 additions
and
1 deletion.
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,145 @@ | ||
name: Release | ||
run-name: Release 🚀 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
POETRY_VERSION: "1.8.3" | ||
PYTHON_VERSION: "3.9" | ||
|
||
|
||
jobs: | ||
|
||
build: | ||
name: Build and Release | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
outputs: | ||
target_version: ${{ steps.export_version.outputs.target_version }} | ||
|
||
steps: | ||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Install Poetry v${{ env.POETRY_VERSION }} | ||
run: pipx install poetry==${{ env.POETRY_VERSION }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Python Semantic Release to prepare release | ||
id: release | ||
uses: python-semantic-release/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
if-no-files-found: 'error' | ||
|
||
- name: Save Tag reference | ||
id: export_version | ||
run: echo "target_version=$(git describe --exact-match | cut -c2-)" >> $GITHUB_OUTPUT | ||
|
||
|
||
publish-to-test-pypi: | ||
name: Publish to Test PyPI | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
test-installation-testpypi: | ||
name: Test installation from Test PyPI | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- publish-to-test-pypi | ||
steps: | ||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Installation test (with retry) | ||
uses: nick-fields/retry@v2 | ||
env: | ||
TARGET_VERSION: ${{needs.build.outputs.target_version}} | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 3 | ||
command: | | ||
pip install -i https://test.pypi.org/simple/ omegaconf_cloud_resolvers[aws,gcp]=="${TARGET_VERSION}" | ||
python -c "import omegaconf_cloud_resolvers; print('Base import: OK')" | ||
python -c "from omegaconf_cloud_resolvers.resolvers.aws import AWSParameterStoreResolver; print('AWS import: OK')" | ||
python -c "from omegaconf_cloud_resolvers.resolvers.gcp import GCPSecretManagerResolver; print('GCP import: OK')" | ||
publish-to-pypi: | ||
name: Publish to PyPI | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test-installation-testpypi | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
publish-docs: | ||
name: Publish Docs | ||
uses: ./.github/workflows/release_docs.yml | ||
|
||
needs: | ||
- build | ||
- test-installation-testpypi | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
with: | ||
ref_tag: "v${{needs.build.outputs.target_version}}" | ||
|
||
|
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,62 @@ | ||
name: Test Package | ||
run-name: Test Package 🔧 | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
workflow_dispatch: | ||
|
||
env: | ||
POETRY_VERSION: "1.8.3" | ||
PCKG_SRC: "omegaconf_cloud_resolvers" | ||
|
||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
|
||
ci: | ||
name: Continuous Integration | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Poetry | ||
run: pipx install poetry==${{ env.POETRY_VERSION }} | ||
|
||
- name: Set up python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: poetry install --all-extras | ||
|
||
- name: Lint with ruff | ||
run: poetry run ruff check . --exit-non-zero-on-fix --show-fixes | ||
|
||
- name: Lint with bandit | ||
run: poetry run bandit -r . -x "./.venv/*,./tests/*,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg" --quiet | ||
|
||
- name: Test with pytest | ||
run: poetry run pytest tests/ --cov=${{env.PCKG_SRC}} --cov-report=xml # store in cov | ||
|
||
- name: Archive code coverage html report # | ||
if: ${{ matrix.python-version == '3.9'}} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: code-coverage-report | ||
path: htmlcov | ||
|
||
- name: Test build docs | ||
run: poetry run mkdocs build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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