Skip to content

Commit

Permalink
chore: add github actions (#1)
Browse files Browse the repository at this point in the history
* chore: add github actions

Signed-off-by: ktro2828 <[email protected]>

* chore: include `poetry.lock` for caching

Signed-off-by: ktro2828 <[email protected]>

---------

Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 authored Oct 1, 2024
1 parent 1ea9d90 commit d99c395
Show file tree
Hide file tree
Showing 5 changed files with 1,846 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build-and-test

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]
paths:
- "**"
- "!docs/**"
- "!README.md"
- "!.github/**"
- .github/workflows/build-and-test.yaml
workflow_dispatch:

jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install poetry
run: pip install poetry

- name: Setup python (with pip)
uses: actions/setup-python@v5
with:
cache: "poetry"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: poetry install

- name: Run tests
run: poetry run pytest
15 changes: 15 additions & 0 deletions .github/workflows/cancel-previous-workflows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: cancel-previous-workflows

on:
pull_request_target:

jobs:
cancel-previous-workflows:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
workflow_id: all
all_but_latest: true
19 changes: 19 additions & 0 deletions .github/workflows/deploy-document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: deploy-document

on:
push:
branches: [main]
workflow_dispatch:

jobs:
deplot-document:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version-file: "pyproject.toml"
cache: "poetry"
- run: poetry install
- run: poetry run mkdocs gh-deploy --force
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ipython_config.py
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
poetry.lock
# poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
Expand Down
Loading

0 comments on commit d99c395

Please sign in to comment.