-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python QA reusable workflow and CI udpate (#32)
* ci: make Python QA reusable * ci: changelog updater * ci: py 3.x for now * ci: remove duplication ------ Co-authored-by: Helen Theissen <[email protected]>
- Loading branch information
1 parent
5354a94
commit af48387
Showing
4 changed files
with
55 additions
and
66 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 |
---|---|---|
@@ -1,36 +1,35 @@ | ||
--- | ||
# .github/workflows/update-changelog.yaml | ||
name: "Update Changelog" | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
# Give the default GITHUB_TOKEN write permission to commit and push the | ||
# updated CHANGELOG back to the repository. | ||
# https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/ | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.release.target_commitish }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.release.target_commitish }} | ||
|
||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
latest-version: ${{ github.event.release.tag_name }} | ||
heading-text: ${{ github.event.release.name }} | ||
release-notes: ${{ github.event.release.body }} | ||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
latest-version: ${{ github.event.release.tag_name }} | ||
heading-text: ${{ github.event.release.name }} | ||
|
||
- name: Commit updated CHANGELOG | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
branch: ${{ github.event.release.target_commitish }} | ||
commit_message: Update CHANGELOG | ||
file_pattern: CHANGELOG.md | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: docs/changelog-update-${{ github.event.release.tag_name }} | ||
title: '[Changelog] Update to ${{ github.event.release.tag_name }}' | ||
add-paths: | | ||
CHANGELOG.md |
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 |
---|---|---|
@@ -1,51 +1,21 @@ | ||
--- | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
|
||
push: {} | ||
pull_request: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
quality: | ||
name: Code QA | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: sudo apt-get install -y pandoc # Needed by sphinx for notebooks | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- uses: pre-commit/[email protected] | ||
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-precommit-run.yml@v2 | ||
with: | ||
skip-hooks: "no-commit-to-branch" | ||
|
||
checks: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: ["ubuntu-latest", "macos-latest"] | ||
python-version: ["3.10"] | ||
|
||
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} | ||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install | ||
run: | | ||
pip install -e .[all,tests] | ||
pip freeze | ||
- name: Tests | ||
run: pytest | ||
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2 | ||
|
||
deploy: | ||
needs: [checks, quality] | ||
|
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,19 @@ | ||
--- | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Code Quality checks for PRs | ||
|
||
on: | ||
push: | ||
pull_request_target: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
quality: | ||
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-precommit-run.yml@v2 | ||
with: | ||
skip-hooks: "no-commit-to-branch" | ||
|
||
checks: | ||
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2 |
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