Skip to content

refactor: initial refactor #4

refactor: initial refactor

refactor: initial refactor #4

name: lint-and-test
on: [pull_request]
env:
DOCKER_FILE_DIRECTORY: environments
DOCKER_COMPOSE_DIRECTORY: environments/ci
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
USE_CACHE: true
jobs:
lint-and-test:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.image }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python-version: ["3.12"]
include:
- os: ubuntu
image: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check version info
run: pwd && docker compose --version && docker --version
- name: Create and start docker container
run: docker compose up -d
working-directory: ${{ env.DOCKER_COMPOSE_DIRECTORY }}
# pytest-cov export coverage data to a file
# However, the directory made by actions/checkout does not allow write
# chmod is needed to resolve above problem
- name: Change permission
run: chmod 777 .
# In the built stage of Docker image, .venv dir is moved from working directory to prevent
# overwrite by volume operation of Docker. Here, .venv is moved back to working directory.
- name: Move .venv directory
run: docker compose exec -T core mv ../.venv .
working-directory: ${{ env.DOCKER_COMPOSE_DIRECTORY }}
- name: Run lint
run: docker compose exec -T core poe lint
working-directory: ${{ env.DOCKER_COMPOSE_DIRECTORY }}
- name: Run test code
run: docker compose exec -T core poe test
working-directory: ${{ env.DOCKER_COMPOSE_DIRECTORY }}