Skip to content

feat: modernize project #190

feat: modernize project

feat: modernize project #190

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
tags:
- "*"
branches:
- main
repository_dispatch:
env:
MAIN_PYTHON_VERSION: '3.10'
DOCUMENTATION_CNAME: 'lamberthub.docs.jorgemartinez.space'
LIBRARY_NAME: 'lamberthub'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
label-syncer:
name: "Sync labels"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
labeler:
name: "Labeler"
needs: [label-syncer]
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
# Label based on modified files
- name: Label based on changed files
uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: ''
# Label based on branch name
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'doc') ||
startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'maint') ||
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
labels: |
enhancement
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'fix') ||
startsWith(github.event.pull_request.head.ref, 'patch')
with:
labels: bug
code-style:
name: "Code style"
runs-on: ubuntu-latest
needs: labeler
steps:
- uses: pyansys/actions/code-style@v4
doc-style:
name: "Doc style"
runs-on: ubuntu-latest
needs: labeler
steps:
- uses: pyansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
tests:
name: "Tests"
runs-on: ${{ matrix.os }}
needs: code-style
strategy:
matrix:
os: [ubuntu-latest]
cfg:
- {python-version: '3.8', extra-args: ''}
- {python-version: '3.9', extra-args: ''}
- {python-version: '3.10', extra-args: '--cov=lamberthub --cov-report=term --cov-report=html:.cov/html'}
fail-fast: false
steps:
- name: "Run tests"
uses: pyansys/actions/tests-pytest@v4
with:
pytest-extra-args: ${{ matrix.cfg.extra-args }}
- name: "Upload coverage"
uses: codecov/codecov-action@v2
if: matrix.cfg.python-version == env.MAIN_PYTHON_VERSION && matrix.os == 'ubuntu-latest'
doc-build:
name: "Doc build"
runs-on: ubuntu-latest
needs: doc-style
steps:
- uses: pyansys/actions/doc-build@v4
build-library:
name: "Build library"
runs-on: ubuntu-latest
needs: [doc-build, tests]
steps:
- uses: pyansys/actions/build-library@v4
with:
library-name: ${{ env.LIBRARY_NAME }}
doc-deploy-dev:
name: "Deploy development documentation"
runs-on: ubuntu-latest
needs: build-library
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags')
steps:
- uses: pyansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
release:
name: "Release"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: build-library
runs-on: ubuntu-latest
steps:
- name: "Release to the public PyPI repository"
uses: pyansys/actions/release-pypi-public@v4
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
- name: "Release to GitHub"
uses: pyansys/actions/release-github@v4
with:
library-name: ${{ env.LIBRARY_NAME }}
doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- uses: pyansys/actions/doc-deploy-stable@v4
with:
cname: ${{ env.LIBRARY_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}