WIP - Adjusting reapply_cors logic to return the first match #1801
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
name: Unit Testing | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Lint and check format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: make lint | |
run: make lint | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@master | |
with: | |
scandir: './scripts' | |
unit-test: | |
name: Unit Tests | |
needs: lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
pyenv: [py39, py310, py311, py312, py312-raw] | |
include: | |
- pyenv: py39 | |
python-version: "3.9" | |
- pyenv: py310 | |
python-version: "3.10" | |
- pyenv: py311 | |
python-version: "3.11" | |
- pyenv: py312 | |
python-version: "3.12" | |
- pyenv: py312-raw | |
python-version: "3.12" | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
memcached: | |
image: memcached | |
options: >- | |
--health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 11211:11211 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: Create database | |
env: | |
PGPASSWORD: postgres | |
run: | | |
psql -c "CREATE DATABASE testdb ENCODING 'UTF8' TEMPLATE template0;" -U postgres -h localhost | |
- name: Run tests with minimal dependencies | |
if: endsWith(matrix.pyenv, '-raw') == true | |
run: make tests-raw | |
- name: Run tests with optional dependencies | |
if: endsWith(matrix.pyenv, '-raw') != true | |
env: | |
COVERAGE_DEBUG: config,trace,pathmap | |
run: make tests | |
- name: Coveralls for ${{ matrix.pyenv }} | |
if: endsWith(matrix.pyenv, '-raw') != true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: ${{ matrix.pyenv }} | |
COVERALLS_PARALLEL: true | |
run: | | |
pip install tomli coveralls | |
coveralls --service=github | |
finish: | |
name: Coveralls Finished | |
needs: unit-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install coveralls | |
run: pip install tomli coveralls | |
- name: Coveralls Finished | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: coveralls --service=github --finish | |
functional: | |
name: Functional | |
needs: lint | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_CACHE: /tmp/docker-cache | |
TEST_TAG: user/app:test | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Print environment | |
run: | | |
python --version | |
pip --version | |
- name: Install dependencies | |
run: | | |
make install-dev | |
- name: Create database | |
env: | |
PGPASSWORD: postgres | |
run: | | |
psql -c "CREATE DATABASE testdb ENCODING 'UTF8' TEMPLATE template0;" -U postgres -h localhost | |
- run: mkdir ${DOCKER_CACHE} | |
- name: Compute cache key | |
# Create hash of hashes of checked in files not in Dockerignore | |
run: echo "CACHE_KEY=$(git ls-tree --full-tree -r HEAD | grep -v -f .dockerignore | awk '{print $3}' | git hash-object --stdin)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.DOCKER_CACHE}} | |
key: docker-build-${{ hashFiles('Dockerfile') }}-${{ env.CACHE_KEY }} | |
restore-keys: | | |
docker-build-${{ hashFiles('Dockerfile') }}-${{ env.CACHE_KEY }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Build container | |
uses: docker/build-push-action@v6 | |
with: | |
cache-from: type=local,src=${{ env.DOCKER_CACHE}} | |
cache-to: type=local,dest=${{ env.DOCKER_CACHE}},mode=max | |
tags: ${{ env.TEST_TAG }} | |
file: Dockerfile | |
load: true | |
context: . | |
- name: Run container | |
run: | | |
docker run --net=host --detach --rm \ | |
-p 8888:8888 \ | |
-v `pwd`/tests/functional.ini:/etc/functional.ini \ | |
-e KINTO_INI=/etc/functional.ini \ | |
${{ env.TEST_TAG }} && sleep 5 | |
- name: Functional Tests | |
run: | | |
make functional | |
kinto-admin: | |
name: Kinto Admin | |
needs: [lint, functional] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
- name: Print environment | |
run: | | |
python --version | |
pip --version | |
node --version | |
npm --version | |
- name: geckodriver/firefox | |
run: | | |
echo "geckodriver/firefox" | |
which geckodriver | |
geckodriver --version | |
which firefox | |
firefox --version | |
- name: make pull-kinto-admin | |
run: make pull-kinto-admin | |
- name: Install dependencies | |
run: make install-dev | |
- name: Start Kinto | |
run: .venv/bin/kinto start --ini tests/browser.ini & sleep 5 | |
- name: Browser Tests | |
run: make browser-test | |
docs: | |
name: Validate docs | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Print environment | |
run: | | |
python --version | |
pip --version | |
- name: make docs | |
run: make docs | |
- name: Package description | |
run: make test-description |