garris / BackstopJS

Catch CSS curve balls.
http://backstopjs.org
MIT License
6.71k stars 603 forks source link

ci(github): adds github workflows for CI/CD (#44) #1526

Closed dgrebb closed 9 months ago

dgrebb commented 9 months ago

GitHub Actions (#44)

In a separate branch, I created some GitHub actions and workflows. Happy to submit a PR with those changes as well. And do a walkthrough if you're curious :)

Tests

Backstop

Docker

A note on Docker and Playwright — to test an image built on GitHub, it seems one must make npm run as root, set 777 permissions on /root and /opt/pw-browsers, reinstall playwright the long way.

In the future I'll make adjustments to the Dockerfile so the workflow doesn't need to override entrypoint. You can see the full, long-form command in .github/workflows/docker-smoke-test.yml and .github/workflows/docker-sanity-test.yml.

The above was resolved in #1523

Various categories of tests have their own workflow, run independently, or together in a reusable workflow. Bringing them all together:

🙈 Backstop & Docker CI

This is a good first step towards a PR-checks workflow, which can run against any fork PRs to the upstream. For example, here are the PR and checks run against this feature in my fork.

Docker Build Artifacts

The docker build workflow initializes the builder, builds the image, tags it as the fork/branch-name (for PR testing purposes), and pushes it to GHCR.

An example of the final workflow-built and pushed container can be seen here. Any fork's workflow-created images will remain unique to their owner.

Docker Tests

All Docker-specific workflows are currently re-installing Playwright by overriding the entrypoint. This had to be done while using the untouched Dockerfile to build this all out. The new Dockerfile in the PR for #34 includes npx playwright install --with-deps to avoid this moving forward.