Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tyutyutyu committed Mar 2, 2024
0 parents commit 96112ba
Show file tree
Hide file tree
Showing 31 changed files with 1,369 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .docker/Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.12.2-alpine3.19

RUN apk add --no-cache \
poetry=1.7.1-r0

RUN addgroup -S app && adduser -S app -G app
RUN mkdir /app \
&& chown app:app /app

USER app

WORKDIR /app

COPY --chown=app:app poetry.lock pyproject.toml /app/
RUN poetry install

COPY --chown=app:app src /app/src
COPY --chown=app:app tests /app/tests

ENTRYPOINT [ "poetry", "run", "pytest" ]

HEALTHCHECK NONE
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @tyutyutyu
33 changes: 33 additions & 0 deletions .github/workflows/merge-main-back-to-develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Merge main back to develop

on:
pull_request:
branches:
- main
types:
- closed

jobs:
merge-main-back-to-develop:
if: github.event.pull_request.merged && github.event.action == 'closed'
runs-on: ubuntu-latest

permissions:
contents: write

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

- name: Set Git config
run: |
git config --local user.email "36857+actions@users.noreply.github.com"
git config --local user.name "Github Actions"
- name: Merge main back to dev
run: |
git fetch --unshallow
git checkout develop
git pull
git merge --no-ff main -m "Auto-merge main back to dev"
git push
62 changes: 62 additions & 0 deletions .github/workflows/release-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish PyPI

on:
push:
branches:
- main

jobs:
release-prod:
name: Publish PyPI
runs-on: ubuntu-latest

environment:
name: release-prod
url: https://pypi.org/p/msps

permissions:
contents: write
id-token: write

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

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry

- name: Install packages
run: poetry install

- name: Build
run: poetry build

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Get version
run: echo "VERSION=$(poetry --short version)" >> $GITHUB_ENV

- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
"${VERSION}"
dist/**
--repo '${{ github.repository }}'
--generate-notes
--title "${VERSION}"
44 changes: 44 additions & 0 deletions .github/workflows/release-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish to TestPyPI

on:
workflow_dispatch:

jobs:
release-test:
name: Publish to TestPyPI
runs-on: ubuntu-latest

environment:
name: release-test
url: https://test.pypi.org/p/msps

permissions:
contents: write
id-token: write

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

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: poetry

- name: Install packages
run: poetry install

- name: Bump version
run: poetry version "$(poetry version --short)${GITHUB_RUN_NUMBER}"

- name: Build
run: poetry build

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
40 changes: 40 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test

on:
push:
branches-ignore:
- main

jobs:
test:
strategy:
fail-fast: false
matrix:
python_version: ["3.10", "3.11", "3.12"]

runs-on: ubuntu-latest

steps:
- name: Update python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
architecture: x64

- name: Install Poetry
run: curl -sSL curl -sSL https://install.python-poetry.org | python3 -

- name: Set env
run: echo "PATH=${PATH}:$HOME/.poetry/bin" >> $GITHUB_ENV

- name: Checkout branch
uses: actions/checkout@v4

- name: Install packages via Poetry
run: poetry install

- name: Check type annotations
run: poetry run mypy

- name: Check code style
run: poetry run pylint msps
Loading

0 comments on commit 96112ba

Please sign in to comment.