End-to-end testing - playwright CI #299
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
name: pr-test | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.7' | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Checkout | |
uses: actions/checkout@master | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('REQUIREMENTS-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Python requirements | |
run: pip install -r REQUIREMENTS-dev.txt | |
- name: Run flake8 | |
run: flake8 --config setup.cfg | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
defaults: | |
run: | |
working-directory: dockerize | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Run docker-compose build | |
run: docker-compose build | |
- name: Run the containers | |
run: docker-compose up -d db devweb | |
- name: Run Coverage test | |
run: | | |
cat << EOF | docker-compose exec -T devweb bash | |
pip install coverage | |
python manage.py makemigrations --merge --noinput | |
python manage.py migrate | |
coverage run manage.py test | |
coverage xml | |
EOF | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Start Django server | |
run: | | |
docker-compose exec -T devweb bash -c "python manage.py loaddata fixtures/*.json" | |
sleep 10 | |
docker-compose exec -T devweb bash -c "nohup python manage.py runserver 0.0.0.0:8080 &" | |
- name: Test django endpoint | |
run: | | |
curl -v http://0.0.0.0:62202 | |
if [ $? -ne 0 ]; then | |
echo "Curl command failed" | |
exit 1 | |
fi | |
- name: Install playwright dependencies | |
working-directory: playwright/ci-test | |
run: | | |
npm install | |
npm ci | |
npx playwright install --with-deps | |
- name: Run Playwright tests | |
working-directory: playwright/ci-test | |
run: npx playwright test | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright/ci-test/playwright-report/ | |
retention-days: 30 |