Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…opier to v0.5.0 (#30)

Co-authored-by: salt-extensions-renovatebot[bot] <182623858+salt-extensions-renovatebot[bot]@users.noreply.github.com>
  • Loading branch information
salt-extensions-renovatebot[bot] authored Oct 7, 2024
1 parent 077bd2c commit 2425eed
Show file tree
Hide file tree
Showing 20 changed files with 861 additions and 58 deletions.
25 changes: 25 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
coverage:
status:
project:
default: false
app:
informational: true
paths:
- src/
tests:
informational: true
paths:
- tests/
patch:
default: false
app:
informational: true
paths:
- src/
tests:
informational: true
paths:
- tests/
github_checks:
annotations: false
7 changes: 5 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Autogenerated. Do not edit this by hand, use `copier update`.
---
_commit: 0.4.5
_commit: 0.5.0
_src_path: https://github.com/salt-extensions/salt-extension-copier
author: jeanluc
author_email: [email protected]
Expand All @@ -16,6 +16,10 @@ loaders:
- state
max_salt_version: '3007'
no_saltext_namespace: false
os_support:
- Linux
- macOS
- Windows
package_name: pushover
project_name: pushover
python_requires: '3.8'
Expand All @@ -27,4 +31,3 @@ summary: Salt Extension for interacting with Pushover
test_containers: false
tracker_url: https://github.com/salt-extensions/saltext-pushover/issues
url: https://github.com/salt-extensions/saltext-pushover
workflows: org
12 changes: 7 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ omit =

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

exclude_also =
# Don't complain about missing debug-only code:
def __repr__

Expand All @@ -26,12 +23,17 @@ exclude_lines =
if 0:
if False:
if __name__ == .__main__.:
if TYPE_CHECKING:
@(abc\.)?abstractmethod

# Add markers which exclude statements in between.
# Requires coverage>=7.6.0.
no cover: start(?s:.)*?no cover: stop

omit =
.nox/*
setup.py


ignore_errors = True

[paths]
Expand Down
135 changes: 135 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
name: CI

on:
workflow_call:
inputs:
deploy-docs:
required: false
type: boolean
default: false
release:
required: false
type: boolean
default: false
version:
required: false
type: string
secrets:
PYPI_API_TOKEN:
required: false
TEST_PYPI_API_TOKEN:
required: false


jobs:
get-changed-files:
name: Get Changed Files
uses: ./.github/workflows/get-changed-files.yml

pre-commit:
name: Pre-Commit
uses: ./.github/workflows/pre-commit-action.yml
needs:
- get-changed-files
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}

test:
name: Test
needs:
- pre-commit
uses: ./.github/workflows/test-action.yml

docs:
name: Docs
needs:
- pre-commit
uses: ./.github/workflows/docs-action.yml

deploy-docs:
name: Deploy Docs
uses: ./.github/workflows/deploy-docs-action.yml
# Only build doc deployments from the default branch of the repo and never for PRs.
if: >-
github.event_name != 'pull_request' &&
inputs.deploy-docs &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
needs:
- docs
- test

build-python-package:
name: Python Package
if: ${{ inputs.release && success() }}
uses: ./.github/workflows/package-action.yml
needs:
- pre-commit
with:
version: "${{ inputs.version }}"

deploy-python-package-test-pypi:
name: Deploy Python Package (Test PyPI)
uses: ./.github/workflows/deploy-package-action.yml
if: ${{ inputs.release && success() }}
needs:
- test
- docs
- build-python-package
secrets:
TEST_PYPI_API_TOKEN: "${{ secrets.TEST_PYPI_API_TOKEN }}"
with:
version: "${{ inputs.version }}"

deploy-python-package:
name: Deploy Python Package (PyPI)
uses: ./.github/workflows/deploy-package-action.yml
if: ${{ inputs.release && success() }}
needs:
- deploy-python-package-test-pypi
secrets:
PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"
with:
test: false
version: "${{ inputs.version }}"

set-pipeline-exit-status:
# This step is just so we can make github require this step, to pass checks
# on a pull request instead of requiring all
name: Set the CI Pipeline Exit Status
runs-on: ubuntu-24.04
if: always()
needs:
- test
- docs
- deploy-docs
- build-python-package
- deploy-python-package-test-pypi
- deploy-python-package

steps:
- name: Download Exit Status Files
if: always()
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: exitstatus
pattern: exitstatus-*
merge-multiple: true

- name: Delete Exit Status Artifacts
if: always()
uses: geekyeggo/delete-artifact@7ee91e82b4a7f3339cd8b14beace3d826a2aac39 # v5.1.0
with:
name: exitstatus-*
useGlob: true
failOnError: false

- name: Set Pipeline Exit Status
run: |
tree exitstatus
grep -RE 'failure|cancelled' exitstatus/ && exit 1 || exit 0
- name: Done
if: always()
run:
echo "All workflows finished"
78 changes: 78 additions & 0 deletions .github/workflows/deploy-docs-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: Publish Documentation

on:
workflow_call:
inputs:
# This is the name of the regular artifact that should
# be transformed into a GitHub Pages deployment.
artifact-name:
type: string
required: false
default: html-docs

jobs:

# The released docs are not versioned currently, only the latest ones are deployed.
#
# Versioning support would require either (better):
# * Rebuilding docs for all versions when a new release is made
# * Version selector support in `furo`: https://github.com/pradyunsg/furo/pull/500
#
# or (more basic):
# * using the `gh-pages` branch and peaceiris/actions-gh-pages
# to be able to deploy to subdirectories. The implementation via
# actions/deploy-pages always replaces the directory root.

Deploy-Docs-GH-Pages:
name: Publish Docs to GitHub Pages

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

permissions:
pages: write
id-token: write

runs-on: ubuntu-24.04

steps:
- name: Download built docs
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.artifact-name }}
path: html-docs

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
name: html-docs-pages
path: html-docs

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
with:
artifact_name: html-docs-pages

- name: Delete GitHub Pages artifact
if: always()
uses: geekyeggo/delete-artifact@7ee91e82b4a7f3339cd8b14beace3d826a2aac39 # v5.1.0
with:
name: html-docs-pages
failOnError: false

- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: exitstatus-${{ github.job }}
path: exitstatus
if-no-files-found: error
54 changes: 54 additions & 0 deletions .github/workflows/deploy-package-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Deploy Salt Extension Python Package

on:
workflow_call:
inputs:
test:
type: boolean
required: false
default: true
version:
type: string
required: true
secrets:
PYPI_API_TOKEN:
required: false
TEST_PYPI_API_TOKEN:
required: false

jobs:
build:
name: Publish Python Package to ${{ fromJSON('["PyPI", "Test PyPI"]')[inputs.test] }}
runs-on: ubuntu-24.04

steps:
- name: Download Python Package Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: salt-extension-${{ inputs.version }}-packages
path: dist

- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@c44d2f0e52f028349e3ecafbf7f32561da677277 # v1.10.3
if: ${{ inputs.test }}
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/

- name: Create GitHub Release
if: ${{ !inputs.test }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${{ inputs.version }}" \
--generate-notes \
dist/*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@c44d2f0e52f028349e3ecafbf7f32561da677277 # v1.10.3
if: ${{ !inputs.test }}
with:
password: ${{ secrets.PYPI_API_TOKEN }}
Loading

0 comments on commit 2425eed

Please sign in to comment.