Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ci workflow #16

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: ci-main
on:
workflow_dispatch:
pull_request:
types: [opened]
branches:
- main

env:
PYTHON_VERSION: "3.10"
POETRY_VERSION: "1.8.3"
POETRY_URL: https://install.python-poetry.org

jobs:
docs-pipeline:
runs-on: ubuntu-latest
permissions:
pages: write
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Bot
run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Cache Python Poetry cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
restore-keys: |
${{ runner.os }}-poetry-

# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files).
- name: Cache Python Packages
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }}
restore-keys: |
${{ runner.os }}-poetry-

- name: Install Poetry ${{ env.POETRY_VERSION }}
run: |
curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }}
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Prepare dependencies
run: make deps

- name: Build dry run
run: make build-dry

29 changes: 26 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

env:
PYTHON_VERSION: "3.10"
POETRY_VERSION: "1.8.3"
POETRY_URL: https://install.python-poetry.org

jobs:
docs-pipeline:
Expand All @@ -22,14 +24,35 @@ jobs:
with:
fetch-depth: 0

- name: Set Bot
run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare dependencies
run: make deps
- name: Cache Python Poetry cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
restore-keys: |
${{ runner.os }}-poetry-

# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files).
- name: Cache Python Packages
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }}
restore-keys: |
${{ runner.os }}-poetry-

- name: Install Poetry ${{ env.POETRY_VERSION }}
run: |
curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }}
echo "$HOME/.local/bin" >> $GITHUB_PATH

- run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Deploy to gh-pages branch
run: poetry run mkdocs gh-deploy
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
clean:
rm -rf /site

deps:
poetry:
pip install --upgrade pip
pip install poetry==1.8.3

deps:
poetry install -v --with docs

serve:
mkdocs serve
poetry run mkdocs serve

build:
mkdocs build
poetry run mkdocs build

build-dry:
poetry run mkdocs build --site-dir="temp"
if [ -d "temp"]; then rm --recursive temp; fi
Loading