Skip to content

Commit

Permalink
ci: Bump build tool versions, add test reporter (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender authored Apr 1, 2024
1 parent 696b101 commit 71e5374
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 163 deletions.
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
# ref: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows

name: Build and Publish
name: Deploy PyPI package

on:
push:
branches:
- main
tags:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:

# production build
build:
name: Build distribution 📦
name: Create package 📦
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install pypa/build
- name: Build library
run: python3 -m pip install build --user

- name: Build a binary wheel and a source tarball
- name: Build wheel and tarball
run: python3 -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v3
- name: Save package
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/


# This will be triggered only when a tag is pushed
publish-to-pypi:
name: Publish to PyPI 🐍
name: Publish to PyPI 🐍 (pypi.org)
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
Expand All @@ -58,19 +59,19 @@ jobs:

steps:

- name: Download all the dists
uses: actions/download-artifact@v3
- name: Download package
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution 📦 to PyPI
- name: Publish package 📦 to pypi.org
uses: pypa/gh-action-pypi-publish@release/v1


# This will be triggered everytime when commit is pushed on main branch
publish-to-testpypi:
name: Publish to TestPyPI 🐍
name: Publish to PyPI 🐍 (test.pypi.org)
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -84,13 +85,13 @@ jobs:

steps:

- name: Download all the dists
uses: actions/download-artifact@v3
- name: Download package
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution 📦 to TestPyPI
- name: Publish package 📦 to test.pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Deploy website

on: [workflow_dispatch]
on: workflow_dispatch

concurrency:
group: docs-website
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v4

- name: Install Ruby
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: docs
Expand All @@ -38,7 +38,7 @@ jobs:
replace: "${{ steps.tag.outputs.version }}"
regex: false

- name: Install GEMs
- name: Setup GEMs
working-directory: docs
env:
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
Expand Down
Original file line number Diff line number Diff line change
@@ -1,70 +1,76 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: write

jobs:
main:
name: validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

# Configure additional validation for the subject based on a regex.
# We enforce that the subject starts with an uppercase character.
subjectPattern: ^([A-Z]).+$

# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
subjectPatternError: >
The subject "**{subject}**" found in the pull request title "*{title}*"
didn't match the configured pattern. Please ensure that the subject
starts with an uppercase character.
# If the PR contains one of these newline-delimited labels, the
# validation is skipped. If you want to rerun the validation when
# labels change, you might want to use the `labeled` and `unlabeled`
# event triggers in your workflow.
ignoreLabels: |
bot
ignore-semantic-pull-request
- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: >
### Hey there and thank you for opening this pull request! 👋🏼
It looks like your proposed **_Pull request title_** needs to be adjusted.
>🚩 **Error** » ${{ steps.lint_pr_title.outputs.error_message }}
#### Pull request title naming convention
Our PR title name taxonomy is `type: Subject`, where **type** is typically
*feat*, *fix*, or *chore*, and **subject** is a phrase (proper noun) that starts with a capitalized letter.
The *chore* type usually has a subject that starts with an action verb like *Add* or *Update*.
Examples: `feat: Admin portal login`, `fix: Divide by zero bug in SMA`, and `chore: Update user docs`.
See the [Conventional Commits specification](https://www.conventionalcommits.org) for more information.
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
name: "Pull request"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: write

jobs:
main:
name: lint PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

# Configure additional validation for the subject based on a regex.
# We enforce that the subject starts with an uppercase character.
subjectPattern: ^([A-Z]).+$

# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
subjectPatternError: >
The subject "**{subject}**" found in the pull request title "*{title}*"
didn't match the configured pattern. Please ensure that the subject
starts with an uppercase character.
# If the PR contains one of these newline-delimited labels, the
# validation is skipped. If you want to rerun the validation when
# labels change, you might want to use the `labeled` and `unlabeled`
# event triggers in your workflow.
ignoreLabels: |
bot
dependencies
- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: >
### Hey there and thank you for opening this pull request! 👋🏼
It looks like your proposed **_Pull request title_** needs to be adjusted.
>🚩 **Error** » ${{ steps.lint_pr_title.outputs.error_message }}
#### Pull request title naming convention
Our PR title name taxonomy is `type: Subject`, where **type** is typically
*feat*, *fix*, or *chore*, and **subject** is a phrase (proper noun) that starts
with a capitalized letter. The *chore* type usually has a subject that starts
with an action verb like *Add* or *Update*. Examples:
- _feat: Admin portal login_
- _fix: Divide by zero bug in SMA_
- _chore: Update packages_
- _docs: Improve setup guidance_
See the [Conventional Commits specification](https://www.conventionalcommits.org) for more information.
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: "Lock Closed Threads"
name: Lock closed threads
# https://github.com/marketplace/actions/lock-threads

on:
schedule:
- cron: "0 7 * * 3"
workflow_dispatch:

permissions:
issues: write
pull-requests: write

concurrency:
group: lock
Expand All @@ -12,8 +17,8 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v4
- uses: dessant/lock-threads@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
process-only: issues, prs
issue-inactive-days: "90"
pr-inactive-days: "30"
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v4

- name: Install Ruby
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: docs
Expand Down Expand Up @@ -56,3 +56,7 @@ jobs:
npx pa11y-ci \
--sitemap http://127.0.0.1:4000/sitemap.xml \
--sitemap-exclude "/*.pdf"
- name: Kill site (failsafe)
if: always()
run: pkill -f jekyll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Website

on:
pull_request:
branches: [main]
Expand All @@ -10,15 +11,15 @@ env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
testing:
test:
name: test URLs
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Ruby
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: docs
Expand All @@ -33,7 +34,7 @@ jobs:
pwd
bundle install
- name: Install HTML Proofer
- name: Setup HTML Proofer
run: gem install html-proofer

- name: Replace "data-src"
Expand Down Expand Up @@ -70,3 +71,7 @@ jobs:
--ignore-status-codes "0,302,403,406,408,429,503,999" \
--swap-urls "https\://python.stockindicators.dev:http\://127.0.0.1:4000" \
--ignore-urls "/fonts.gstatic.com/"
- name: Kill site (failsafe)
if: always()
run: pkill -f jekyll
Loading

0 comments on commit 71e5374

Please sign in to comment.