diff --git a/.github/workflows/lighthouse-ci.yml b/.github/workflows/lighthouse-ci.yml new file mode 100644 index 0000000..631ac4f --- /dev/null +++ b/.github/workflows/lighthouse-ci.yml @@ -0,0 +1,37 @@ +name: Lighthouse CI + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + lhci: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Prepare secrets + # we could use poetry run python manage.py createsecrets -o .env + # but this would require us to: + # 1. set up Python + # 2. install Poetry + # 3. install dependencies + # instead, we copy the example debug config file to save CI resources + run: cp .env.local .env + + - name: Build Docker images + run: docker-compose -f docker-compose.yml -f docker-compose.dev.yml build --parallel + + - name: Run Lighthouse CI + run: | + npm install -g @lhci/cli@0.6.1 + lhci autorun diff --git a/lighthouserc.js b/lighthouserc.js new file mode 100644 index 0000000..17e3588 --- /dev/null +++ b/lighthouserc.js @@ -0,0 +1,12 @@ +module.exports = { + ci: { + collect: { + url: ['http://localhost:8000/'], + startServerCommand: 'docker-compose -f docker-compose.yml -f docker-compose.prod.yml up', + startServerReadyTimeout: 60000, + }, + upload: { + target: 'temporary-public-storage', + }, + }, +};