Skip to content

fix(package): Move docker/docker-compose.yaml to `docker/compose.ya… #11

fix(package): Move docker/docker-compose.yaml to `docker/compose.ya…

fix(package): Move docker/docker-compose.yaml to `docker/compose.ya… #11

name: Validation
on:
workflow_dispatch:
pull_request:
paths-ignore:
- '**.rst'
push:
jobs:
# NOTE: https://commitlint.js.org/guides/ci-setup.html
lint-commit:
name: Lint Commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install required dependencies
run: |
sudo apt update && sudo apt install -y git curl
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest @commitlint/config-conventional
- name: Print versions
run: |
echo "git version: $(git --version)" >> $GITHUB_STEP_SUMMARY
echo "node version: $(node --version)" >> $GITHUB_STEP_SUMMARY
echo "npm version: $(npm --version)" >> $GITHUB_STEP_SUMMARY
echo "commitlint version: $(npx commitlint --version)" >> $GITHUB_STEP_SUMMARY
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose
lint-code:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Venv and Setup
run: |
echo "## Python Info\n" >> $GITHUB_STEP_SUMMARY
echo "- Python Version: $( python --version )" >> $GITHUB_STEP_SUMMARY
echo "- Python Binary: $( which python )" >> $GITHUB_STEP_SUMMARY
python -m venv .venv
source .venv/bin/activate
python -m pip install poetry mypy ruff
poetry install
- name: MyPy Check Source.
id: mypy_check_src
run: |
source .venv/bin/activate
echo "## MyPy \`./src\`" >> $GITHUB_STEP_SUMMARY
poetry run mypy --config-file pyproject.toml --pretty ./src >> $GITHUB_STEP_SUMMARY
continue-on-error: true
- name: MyPy Check Tests.
id: mypy_check_tests
run: |
source .venv/bin/activate
echo "## MyPy \`./tests\`\n\n~~~stdout" >> $GITHUB_STEP_SUMMARY
poetry run mypy --config-file pyproject.toml --pretty ./tests >> $GITHUB_STEP_SUMMARY
echo "~~~\n" >> $GITHUB_STEP_SUMMARY
continue-on-error: true
- name: Ruff Linting.
id: ruff
run: |
source .venv/bin/activate
echo "## Ruff\n\n~~~stdout" >> $GITHUB_STEP_SUMMARY
poetry run ruff check --config pyproject.toml --output-format github .>> $GITHUB_STEP_SUMMARY
echo "~~~" >> $GITHUB_STEP_SUMMARY
continue-on-error: true
- run: |
if ( \
[ "${{ steps.mypy_check_src.outcome }}" != "success" ] \
|| [ "${{ steps.mypy_check_tests.outcome }}" != "success" ] \
|| [ "${{ steps.ruff.outcome }}" != 'success' ]
); then
echo "One or more checks failed. See the summary for details."
exit 1
fi
pytest:
name: PyTest
runs-on: ubuntu-latest
steps:
- name: Checkout.
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
# NOTE: ``mkdir`` step is required for propper permissions on ~/.venv
- name: Start Docker Compose Project.
run: |
mkdir docker/.venv
docker compose --file docker/compose.yaml up --detach
docker compose --file docker/compose.yaml exec \
bash -c "python -m venv .venv"
- name: Install Dependencies In Server.
run: |
docker compose --file docker/compose.yaml exec server \
bash -c 'source ~/.bashrc && pip install poetry && poetry install --with test'
- name: Generate Dummy Data In Server.
run: |
docker compose --file docker/compose.yaml exec server \
bash -c 'source ~/.bashrc && pip install poetry && poetry run captura config'
- name: Run Tests.
run: |
docker compose --file docker/compose.yaml exec server \
bash -c 'source ~/.bashrc \
&& pip install poetry \
&& CAPTURA_CONFIG_APP_TEST=/home/captura/app/tests/assets/act.yaml \
CAPTURA_CONFIG_CLIENT_TEST=/home/captura/app/tests/assets/act.yaml \
CAPTURA_FLAKEY=FLAKEY=/home/captura/flakey.yaml \
poetry run pytest --count 1'