From 1906aa927412246dba2acb8df45aa4bebc22b1aa Mon Sep 17 00:00:00 2001 From: Ignacio Bolonio <> Date: Wed, 3 Jan 2024 13:11:56 +0100 Subject: [PATCH] Add release drafter workflow --- .github/workflows/lint-and-test.yml | 4 ++++ .github/workflows/release-drafter.yml | 32 +++++++++++++++++++++++++++ Makefile | 6 +++++ pyproject.toml | 7 +++++- tests/test_constants.py | 2 ++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 2ad775c4..d059ebea 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -26,3 +26,7 @@ jobs: - run: make lint - run: make coverage + if: github.ref != 'refs/heads/master' + + - run: make coverage-master + if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..56eaca4b --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,32 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + # pull_request event is required only for autolabeler + pull_request: + # Only following types are handled by the action, but one can default to all as well + types: [opened, reopened, synchronize] + # pull_request_target event is required for autolabeler to support PRs from forks + pull_request_target: + types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Makefile b/Makefile index 7df9936b..9dca725a 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,12 @@ coverage: coverage xml -i -o build/coverage.xml coverage html +coverage-master: + coverage run --source=pycfmodel --branch -m pytest tests/ --junitxml=build/test.xml -v -m "not actions" + coverage report + coverage xml -i -o build/coverage.xml + coverage html + test: lint unit test-docs: diff --git a/pyproject.toml b/pyproject.toml index 2a6f27c9..e0c5865e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,4 +70,9 @@ indent-style = "space" skip-magic-trailing-comma = false # Like Black, automatically detect the appropriate line ending. -line-ending = "auto" \ No newline at end of file +line-ending = "auto" + +[tool.pytest.ini_options] +markers = [ + "actions: marks tests that checks the full list of IAM actions (deselect with '-m \"not actions\"')", +] \ No newline at end of file diff --git a/tests/test_constants.py b/tests/test_constants.py index 902613aa..966f9df1 100644 --- a/tests/test_constants.py +++ b/tests/test_constants.py @@ -1,10 +1,12 @@ import json import httpx +import pytest from pycfmodel.cloudformation_actions import CLOUDFORMATION_ACTIONS +@pytest.mark.actions def test_cloudformation_actions(): response = httpx.get("https://awspolicygen.s3.amazonaws.com/js/policies.js") response.raise_for_status()