Upgrade dependencies and remove pytest-bdd patch #2638
Workflow file for this run
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
# This workflow will install Python dependencies and run tests with Python | |
# For more information see: | |
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Pytest | |
on: | |
push: | |
paths: | |
- '**.py' | |
- '**.js' | |
- '**.scss' | |
- '**.jinja2' | |
- '.flaskenv' | |
- '.testenv' | |
- 'package-lock.json' | |
- 'requirements/base.txt' | |
- 'requirements/test.txt' | |
- '.github/workflows/pytest.yml' | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pytest: | |
name: Pytest | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COLUMNS: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] # TODO: Figure out macos-latest and Docker | |
python-version: ['3.11', '3.12'] | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: --entrypoint redis-server | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Setup Docker on macOS | |
uses: docker-practice/[email protected] | |
if: ${{ matrix.os == 'macos-latest' }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Chrome (for browser testing) | |
uses: browser-actions/setup-chrome@latest | |
- name: Install Chromedriver (for browser testing) | |
uses: nanasess/setup-chromedriver@v2 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: 'requirements/*.txt' | |
- name: Cache python packages | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ matrix.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements.txt/test.txt') }} | |
- name: Install Python dependencies | |
run: make install-python-test | |
- name: Install Playwright browser | |
run: make install-playwright | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ join(matrix.*, '-') }}-node_modules-${{ hashFiles('package-lock.json') }} | |
- name: Cache built assets | |
uses: actions/cache@v3 | |
with: | |
path: funnel/static/build | |
key: ${{ join(matrix.*, '-') }}-assets-build | |
- name: Cache .webpack_cache | |
uses: actions/cache@v3 | |
with: | |
path: .webpack_cache | |
key: ${{ join(matrix.*, '-') }}-webpack_cache | |
- name: Install Node dependencies | |
run: make install-npm | |
- name: Build Webpack assets | |
run: make assets | |
- name: Annotate Pytest failures in PR | |
run: pip install pytest-github-actions-annotate-failures | |
- name: Setup hostnames | |
run: | | |
sudo -- sh -c "echo '127.0.0.1 funnel.test' >> /etc/hosts" | |
sudo -- sh -c "echo '127.0.0.1 f.test' >> /etc/hosts" | |
- name: Create PostgreSQL databases | |
run: | | |
sudo apt-get install postgresql-client -y | |
psql -h localhost -U postgres -c "create user $(whoami);" | |
psql -h localhost -U postgres -c "create database funnel_testing;" | |
psql -h localhost -U postgres -c "create database geoname_testing;" | |
set -a; source .testenv; set +a | |
FLASK_ENV=testing flask dbconfig | psql -h localhost -U postgres funnel_testing | |
FLASK_ENV=testing flask dbconfig | psql -h localhost -U postgres geoname_testing | |
psql -h localhost -U postgres -c "grant all privileges on database funnel_testing to $(whoami);" | |
psql -h localhost -U postgres -c "grant all privileges on database geoname_testing to $(whoami);" | |
psql -h localhost -U postgres funnel_testing -c "grant all privileges on schema public to $(whoami); grant all privileges on all tables in schema public to $(whoami); grant all privileges on all sequences in schema public to $(whoami);" | |
psql -h localhost -U postgres geoname_testing -c "grant all privileges on schema public to $(whoami); grant all privileges on all tables in schema public to $(whoami); grant all privileges on all sequences in schema public to $(whoami);" | |
- name: Test with pytest | |
run: | | |
pytest --showlocals --ignore=tests/e2e --cov=funnel | |
- name: Browser tests with pytest | |
timeout-minutes: 5 | |
run: | | |
pytest --showlocals --cov-append --cov=funnel tests/e2e | |
- name: Prepare coverage report | |
run: | | |
mkdir -p coverage | |
coverage lcov -o coverage/funnel.lcov | |
- name: Upload coverage report to Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: ./coverage/funnel.lcov | |
flag-name: python-${{ matrix.python-version }} | |
parallel: true | |
finish: | |
needs: pytest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish to Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: ./coverage/funnel.lcov | |
parallel-finished: true |