Skip to content

Commit

Permalink
👷 Update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Feb 10, 2024
1 parent 19aa32b commit 6d862c3
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 39 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
"on":
push:
paths-ignore:
- "**.md"
- docs/*
pull_request:
paths-ignore:
- "**.md"
- docs/*
workflow_dispatch:

# https://github.com/softprops/action-gh-release/issues/236
permissions:
contents: write

env:
PYTHONUTF8: "1"
python-version: 3.x
cache: pip

jobs:
test:
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{matrix.runs-on}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{env.python-version}}
cache: ${{env.cache}}
cache-dependency-path: |-
requirements.txt
requirements/dev.txt
- name: Install dependencies
run: |
pip install -e '.[dev]'
- name: Test
run: |
pytest --cov
- uses: codecov/codecov-action@v3

build:
needs: test
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{matrix.runs-on}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{env.python-version}}
cache: ${{env.cache}}
cache-dependency-path: |-
requirements.txt
requirements/dev.txt
- name: Install dependencies
run: |
pip install build
- name: Build
run: |
pyproject-build
- uses: pypa/gh-action-pypi-publish@release/v1
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/')
with:
password: ${{secrets.PYPI_API_TOKEN}}
- uses: actions/upload-artifact@v3
if: runner.os == 'Linux' && ! startsWith(github.ref, 'refs/tags/')
with:
path: |
dist/*
- uses: softprops/action-gh-release@v1
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/')
with:
# body_path: build/CHANGELOG.md
files: |
dist/*
39 changes: 0 additions & 39 deletions .github/workflows/tests.yml

This file was deleted.

3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env -S pip install -r

ruff
4 changes: 4 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env -S pip install -r
# For unit test and code coverage rate test.

pytest-cov

0 comments on commit 6d862c3

Please sign in to comment.