diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..7900c9c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,48 @@ +name: Build +on: + workflow_dispatch: + pull_request: + push: + branches: [main] +jobs: + build: + name: Build Package + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + os: [windows, ubuntu, macos] + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: Setup Python + uses: actions/setup-python@v5.0.0 + with: + python-version: 3.11 + + - name: Setup Poetry + uses: threeal/setup-poetry-action@v1.0.0 + + - name: Cache Dependencies + id: cache-deps + uses: actions/cache@v3.3.2 + with: + path: .venv + key: poetry-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} + + - name: Install Dependencies + if: steps.cache-deps.outputs.cache-hit != 'true' + run: poetry install --with dev + + - name: Check Format + run: poetry run poe format && git diff --exit-code HEAD + + - name: Check Lint + run: poetry run poe lint + + - name: Test Package + run: poetry run poe test + + - name: Generate Documentation + run: poetry run poe docs diff --git a/.github/workflows/ci.yaml b/.github/workflows/deploy.yaml similarity index 53% rename from .github/workflows/ci.yaml rename to .github/workflows/deploy.yaml index 90238a0..0e834cd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/deploy.yaml @@ -1,18 +1,25 @@ -name: CI +name: Deploy on: workflow_dispatch: - pull_request: push: branches: [main] jobs: - build: - name: Build - runs-on: ${{ matrix.os }}-latest - strategy: - fail-fast: false - matrix: - os: [windows, ubuntu, macos] + deploy-pages: + name: Deploy Pages + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deploy-pages.outputs.page_url }} + concurrency: + group: pages + cancel-in-progress: false steps: + - name: Setup Pages + uses: actions/configure-pages@v4.0.0 + - name: Checkout uses: actions/checkout@v4.1.1 @@ -24,54 +31,25 @@ jobs: - name: Setup Poetry uses: threeal/setup-poetry-action@v1.0.0 - - name: Cache deps - id: cache_deps + - name: Cache Dependencies + id: cache-deps uses: actions/cache@v3.3.2 with: path: .venv key: poetry-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} - - name: Install deps - if: steps.cache_deps.outputs.cache-hit != 'true' + - name: Install Dependencies + if: steps.cache-deps.outputs.cache-hit != 'true' run: poetry install --with dev - - name: Check format - run: poetry run poe format && git diff --exit-code HEAD - - - name: Check lint - run: poetry run poe lint - - - name: Run testing - run: poetry run poe test - - - name: Generate docs + - name: Generate Documentation run: poetry run poe docs - - name: Upload docs artifact - if: ${{ matrix.os }} == 'ubuntu' + - name: Upload Documentation uses: actions/upload-pages-artifact@v3.0.0 with: path: docs - deploy: - name: Deploy - if: github.event_name != 'pull_request' && github.ref_name == 'main' - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - concurrency: - group: pages - cancel-in-progress: false - steps: - - name: Setup Pages - uses: actions/configure-pages@v4.0.0 - - name: Deploy Pages - id: deployment + id: deploy-pages uses: actions/deploy-pages@v4.0.2 diff --git a/README.md b/README.md index 19ffec3..b90b350 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![version](https://img.shields.io/github/v/release/threeal/python-starter?style=flat-square)](https://github.com/threeal/python-starter/releases) [![license](https://img.shields.io/github/license/threeal/python-starter?style=flat-square)](./LICENSE) -[![build status](https://img.shields.io/github/actions/workflow/status/threeal/python-starter/ci.yaml?branch=main&style=flat-square)](https://github.com/threeal/python-starter/actions/workflows/ci.yaml) +[![build status](https://img.shields.io/github/actions/workflow/status/threeal/python-starter/build.yaml?branch=main&style=flat-square)](https://github.com/threeal/python-starter/actions/workflows/build.yaml) +[![deploy status](https://img.shields.io/github/actions/workflow/status/threeal/python-starter/deploy.yaml?branch=main&label=deploy&style=flat-square)](https://github.com/threeal/python-starter/actions/workflows/deploy.yaml) The Python Starter is a [GitHub repository template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) that provides a minimalistic boilerplate to kickstart your [Python](https://www.python.org/) project. This template offers a streamlined foundation, complete with predefined file structures, essential tools, and recommended settings, ensuring a swift and efficient start to your Python development journey.