Skip to content

Commit

Permalink
Add a script for testing actions locally
Browse files Browse the repository at this point in the history
Using `act` [1].

However, act uses network mode `host` by default [2]. Multiple Cypress
instances will check for X and start it, concurrently and not in an
atomic way, causing issues.

Container options specified in workflows and using --container-options
*aren't* merged [3].

Furthermore, specifying a network  option that works both on GHA and
locally appears to be a bit tricky [4].

Thus, using `xvfb-run` to create a shared fb appears to be the easiest
solution.

However, `act` doesn't support env pass through, so we must parse
`$DISPLAY` inside the xvfb environment in order to explicitly provide it
to `act`.

This would have all been unnecessary if `ELECTRON_RUN_AS_NODE` had even
remotely worked [5].

[1] https://nektosact.com/
[2] nektos/act#1739
[3] nektos/act#1696
[4] nektos/act#1740
[5] cypress-io/cypress-documentation#5666
  • Loading branch information
badeball committed Apr 27, 2024
1 parent 38e6aa1 commit a135df3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"test:unit": "mocha",
"test:run-all-specs": "mocha --timeout 0 test/run-all-specs.ts",
"test:integration": "cucumber-js",
"test:actions:examples": "xvfb-run bash -c 'act -W \".github/workflows/examples-branch.yml\" --use-gitignore=false --artifact-server-path=tmp/artifacts --env DISPLAY=$DISPLAY'",
"prepublishOnly": "npm run clean && npm run build && npm run test"
},
"dependencies": {
Expand Down

0 comments on commit a135df3

Please sign in to comment.