Skip to content

Commit

Permalink
Merge pull request #5 from thombashi/update_ci
Browse files Browse the repository at this point in the history
Update CI
  • Loading branch information
thombashi authored Apr 27, 2024
2 parents 6e169d6 + a1ee0ed commit baeba3d
Showing 1 changed file with 96 additions and 11 deletions.
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/gh-action-sigstore-python@v2.1.1
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

0 comments on commit baeba3d

Please sign in to comment.