Skip to content

ci: switch from cicleci to github actions #27

ci: switch from cicleci to github actions

ci: switch from cicleci to github actions #27

Workflow file for this run

name: web_api
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@c449d86cf33a2a6c7a4193264cc2578e2c3266d4 # pin@v4
with:
paths: '["web_api/**", ".github/workflows/**"]'
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:5
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./web_api/.python-version"
cache: poetry
cache-dependency-path: "./web_api/poetry.lock"
- name: Install dependencies
working-directory: "./web_api"
run: poetry install
- name: Set up environment variables
run: echo "DATABASE_URL=postgres://postgres:[email protected]:5432/postgres" >> $GITHUB_ENV
- name: Run tests
working-directory: "web_api"
run: ./s/test
- name: upload code coverage
working-directory: web_api
run: ./s/upload-code-cov
lint:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./web_api/.python-version"
cache: poetry
cache-dependency-path: "./web_api/poetry.lock"
- name: Install dependencies
working-directory: "./web_api"
run: poetry install
- name: Run lints
working-directory: "web_api"
run: ./s/lint
squawk:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: web_api_test
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./web_api/.python-version"
cache: poetry
cache-dependency-path: "./web_api/poetry.lock"
- name: Install dependencies
working-directory: "./web_api"
run: poetry install
- name: Run squawk
working-directory: "./web_api"
run: |
python ./s/squawk.py
- uses: sbdchd/squawk-action@v1
with:
pattern: "web_api/migrations/*.sql"
version: "latest"