js: Make language code handling more robust, add tests #159
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: E2E tests with docker | |
on: | |
pull_request: | |
paths: | |
- "isso/**" | |
- "package.json" | |
- "docker/**" | |
- "docker-compose.yml" | |
- "Dockerfile" | |
- ".github/workflows/e2e-tests.yml" | |
push: | |
paths: | |
- "isso/**" | |
- "package.json" | |
- "docker/**" | |
- "docker-compose.yml" | |
- "Dockerfile" | |
- ".github/workflows/e2e-tests.yml" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
TESTBED_IMAGE: "ghcr.io/isso-comments/isso-js-testbed:latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Switch testbed image to ${{ env.TESTBED_IMAGE }} | |
# Just for faster CI runs, instead of re-building the image every time | |
# Especially useful to save the time+bandwidth to re-download puppeteer & chromium | |
run: | | |
sed -i "s|isso-js-testbed|${{ env.TESTBED_IMAGE }}|g" docker-compose.yml | |
# Also remove the `build`: section so image is pulled, not built | |
sed -i '/container_name: isso-client/{n;N;N;d}' docker-compose.yml | |
- name: Pull testbed from ${{ env.TESTBED_IMAGE }} | |
run: docker pull ${{ env.TESTBED_IMAGE }} | |
- name: Build the stack | |
run: docker compose build isso-server | |
- name: Bring up containers | |
run: docker compose up -d | |
- name: Client unit tests | |
run: make docker-js-unit | |
- name: Check if containers are up, sleep if not | |
shell: bash | |
run: '[ "$(docker inspect --format={{.State.Health.Status}} isso-server)" = "healthy" ] || sleep 5' | |
- name: Client integration tests | |
run: make docker-js-integration | |
- name: Compare screenshots | |
# Allow continuing to generate updated hashes in next step | |
id: compare-screenshots | |
continue-on-error: true | |
run: make docker-compare-screenshots | |
- name: Update screenshot hashes (if mismatched) | |
if: ${{ steps.compare-screenshots.outcome == 'failure' }} | |
run: make docker-update-screenshots | |
- name: Archive and upload updated screenshots & hashes | |
if: ${{ steps.compare-screenshots.outcome == 'failure' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: updated-screenshots-and-hashes | |
path: isso/js/tests/screenshots/reference/ | |
- name: Fail if "Compare screenshots" step failed | |
if: ${{ steps.compare-screenshots.outcome == 'failure' }} | |
run: /bin/false |