Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI #5

Merged
merged 9 commits into from
Apr 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 96 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,122 @@ on:
- "README.rst"
- "ss/*"
pull_request:
branches-ignore:
- master
paths-ignore:
- ".gitignore"
- "README.rst"
- "ss/*"

permissions:
contents: read

jobs:
build-package:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-build
cancel-in-progress: true
timeout-minutes: 20
container:
image: ghcr.io/thombashi/python-ci:3.11

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini

- run: make setup-ci

- run: make build

- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*

publish-package:
needs: build-package
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-publish-pkg
cancel-in-progress: true
timeout-minutes: 20
environment:
name: testpypi
url: https://pypi.org/p/tcolorpy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist

- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true

sign-package:
needs: build-package
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-sign-pkg
cancel-in-progress: true
timeout-minutes: 20
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist

- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl

- uses: actions/upload-artifact@v4
with:
name: sigstore
path: ./dist/*.sigstore

lint:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-lint
cancel-in-progress: true
timeout-minutes: 20
container:
image: ghcr.io/thombashi/python-ci:3.11

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini

- run: make setup-ci

- run: make check

Expand All @@ -55,6 +138,9 @@ jobs:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-latest
python-version: "3.7"
timeout-minutes: 20

steps:
Expand All @@ -70,19 +156,18 @@ jobs:
**/*requirements.txt
tox.ini

- name: Install pip
run: python -m pip install --upgrade --disable-pip-version-check "pip>=21.1"
- name: Upgrade pip
run: python -m pip install --upgrade --disable-pip-version-check pip

- run: make setup-ci

- name: Run tests
run: |
tox -e cov
run: tox -e cov
env:
PYTEST_DISCORD_WEBHOOK: ${{ secrets.PYTEST_DISCORD_WEBHOOK }}

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
run: |
python -m pip install --upgrade --disable-pip-version-check coveralls tomli
coveralls --service=github
Expand Down
Loading