Skip to content

Commit

Permalink
Merge pull request #15 from betaboon/migrate-to-copier-template
Browse files Browse the repository at this point in the history
chore: migrate to copier-template
  • Loading branch information
betaboon authored Jan 30, 2024
2 parents 3f2ff4d + c1f22ce commit 8584643
Show file tree
Hide file tree
Showing 91 changed files with 2,392 additions and 1,507 deletions.
21 changes: 21 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changes here will be overwritten by Copier
_commit: 110754b
_src_path: gh:betaboon/copier-python
author_email: [email protected]
author_name: betaboon
copyright_holder: betaboon
copyright_license: Apache-2.0
copyright_year: '2024'
project_description: A EventstoreDB gRPC client written in python .
project_name: EventstoreDB Client Python
python_console_script: false
python_import_name: eventstoredb
python_package_name: eventstoredb
python_versions:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
repository_name: EventStoreDB-Client-Python
repository_namespace: betaboon
repository_provider: github
17 changes: 15 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
export VIRTUAL_ENV=.venv
layout python
# vi: ft=sh

# use nix shell if nix is available
if command -v nix &> /dev/null; then
use_nix
fi

# use venv if one exists
if [ -d ".venv" ]; then
export VIRTUAL_ENV=.venv
layout python
fi

# load local config
source_env_if_exists .envrc.local
30 changes: 30 additions & 0 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build docs

on:
workflow_call:

jobs:
build:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
cache: true
- name: Install dependencies
run: pdm sync -G :all
- name: Run build
run: pdm run docs-build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: ${{ github.workspace }}/docs/_build
retention-days: 1
if-no-files-found: error
45 changes: 45 additions & 0 deletions .github/workflows/build-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build package

on:
workflow_call:
inputs:
version:
description: "Version of the package"
type: string
required: true

jobs:
build:
name: Build package
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
cache: true
- name: Install dependencies
run: pdm sync -G :all
- name: Run build
run: pdm build
env:
PDM_BUILD_SCM_VERSION: ${{ inputs.version }}
- name: Upload artifacts
uses: actions/upload-artifact@v3 # v4 has a bug: https://github.com/actions/upload-artifact/issues/506
with:
name: package
path: ${{ github.workspace }}/dist
overwrite: true
retention-days: 1
if-no-files-found: error
74 changes: 74 additions & 0 deletions .github/workflows/ci-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI

on:
push:
branches:
- main

concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true

jobs:
lint:
uses: ./.github/workflows/lint.yaml
secrets: inherit

test:
uses: ./.github/workflows/test.yaml
secrets: inherit

prepare-release:
needs:
- lint
- test
uses: ./.github/workflows/prepare-release.yaml
secrets: inherit

build-package:
needs:
- prepare-release
if: needs.prepare-release.outputs.new-release == 'true'
uses: ./.github/workflows/build-package.yaml
secrets: inherit
with:
version: ${{ needs.prepare-release.outputs.version }}

build-docs:
needs:
- prepare-release
if: needs.prepare-release.outputs.new-release == 'true'
uses: ./.github/workflows/build-docs.yaml
secrets: inherit

publish-pypi:
needs:
- build-package
- build-docs
uses: ./.github/workflows/publish-pypi.yaml
secrets: inherit
permissions:
id-token: write

publish-github:
needs:
- prepare-release
- build-package
- publish-pypi
uses: ./.github/workflows/publish-github.yaml
secrets: inherit
permissions:
contents: write
with:
version: ${{ needs.prepare-release.outputs.version }}
changelog: ${{ needs.prepare-release.outputs.changelog }}

publish-docs:
needs:
- build-docs
- publish-pypi
uses: ./.github/workflows/publish-docs.yaml
secrets: inherit
permissions:
id-token: write
pages: write
40 changes: 40 additions & 0 deletions .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PR

on:
pull_request:
branches:
- main

concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true

jobs:
lint:
uses: ./.github/workflows/lint.yaml
secrets: inherit

test:
uses: ./.github/workflows/test.yaml
secrets: inherit

build-docs:
uses: ./.github/workflows/build-docs.yaml
secrets: inherit

passed:
needs:
- lint
- test
- build-docs
runs-on: ubuntu-latest
steps:
- name: Check lint status
if: ${{ needs.lint.result != 'success' }}
run: exit 1
- name: Check test status
if: ${{ needs.test.result != 'success' }}
run: exit 1
- name: Check build docs status
if: ${{ needs.build-docs.result != 'success' }}
run: exit 1
88 changes: 0 additions & 88 deletions .github/workflows/ci.yaml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Lint

on:
workflow_call:

jobs:
lint-code:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up PDM
id: pdm
uses: pdm-project/setup-pdm@v4
with:
cache: true
- name: Install dependencies
run: pdm sync -G :all
- name: Cache pre-commit dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ steps.pdm.outpus.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run lint
run: pdm run _ci-lint-code
env:
FROM_REF: origin/${{ github.event.repository.default_branch }}
TO_REF: HEAD

lint-commits:
name: Lint commit messages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
cache: true
- name: Install dependencies
run: pdm sync -G :all
- name: Run lint-commits
run: pdm run _ci-lint-commits
env:
FROM_REF: origin/${{ github.event.repository.default_branch }}
TO_REF: HEAD

passed:
needs:
- lint-code
- lint-commits
runs-on: ubuntu-latest
steps:
- name: Check lint code status
if: ${{ needs.lint-code.result != 'success' }}
run: exit 1
- name: Check lint commits status
if: ${{ needs.lint-commits.result != 'success' }}
run: exit 1
Loading

0 comments on commit 8584643

Please sign in to comment.