Skip to content

Commit

Permalink
run cyprss in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed Jun 28, 2024
1 parent bb13b38 commit c13f1ab
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 3 deletions.
96 changes: 95 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,103 @@ jobs:
uses: './.github/actions/iota-sandbox/setup'

- name: Run Wasm examples
run: npm run test:examples
run: npm run test:readme && npm run test:node
working-directory: bindings/wasm

- name: Tear down iota sandbox
if: always()
uses: './.github/actions/iota-sandbox/tear-down'

test-wasm-firefox:
needs: build-wasm
if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
include:
- os: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Install JS dependencies
run: npm ci
working-directory: bindings/wasm

- name: Download bindings/wasm artifacts
uses: actions/download-artifact@v2
with:
name: identity-wasm-bindings-build
path: bindings/wasm

- name: Start iota sandbox
uses: './.github/actions/iota-sandbox/setup'

- name: Build Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: bindings/wasm/
file: bindings/wasm/cypress/Dockerfile
push: false
labels: cypress-test:latest

- name: Run cypress
run: docker run cypress-test --browser firefox

- name: Tear down iota sandbox
if: always()
uses: './.github/actions/iota-sandbox/tear-down'

test-wasm-chrome:
needs: build-wasm
if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
include:
- os: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Install JS dependencies
run: npm ci
working-directory: bindings/wasm

- name: Download bindings/wasm artifacts
uses: actions/download-artifact@v2
with:
name: identity-wasm-bindings-build
path: bindings/wasm

- name: Start iota sandbox
uses: './.github/actions/iota-sandbox/setup'

- name: Build Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: bindings/wasm/
file: bindings/wasm/cypress/Dockerfile
push: false
labels: cypress-test:latest

- name: Run cypress
run: docker run cypress-test --browser chrome

- name: Tear down iota sandbox
if: always()
uses: './.github/actions/iota-sandbox/tear-down'
2 changes: 2 additions & 0 deletions bindings/wasm/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
target
11 changes: 11 additions & 0 deletions bindings/wasm/cypress/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM cypress/browsers:latest

COPY ./ /e2e

WORKDIR /e2e

RUN npm ci

RUN npm run build:examples:web

ENTRYPOINT [ "npm", "run" ]
3 changes: 1 addition & 2 deletions bindings/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"build:examples:web": "tsc --project ./examples/tsconfig.web.json && node ./build/replace_paths ./examples/tsconfig.web.json ./examples/dist resolve",
"build": "npm run build:web && npm run build:nodejs && npm run build:docs",
"example:node": "ts-node --project tsconfig.node.json -r tsconfig-paths/register ./examples/src/main.ts",
"test": "npm run test:unit:node && npm run test:examples",
"test:examples": "npm run test:readme && concurrently -g --timings \"npm run test:node\" \"npm run test:browser:parallel\"",
"test": "npm run test:unit:node && npm run test:readme && npm run test:node && test:browser:parallel",
"test:node": "ts-mocha -r tsconfig-paths/register -p tsconfig.node.json ./examples/src/tests/*.ts --parallel --jobs 4 --retries 3 --timeout 180000 --exit",
"test:browser:parallel": "npm run build:examples:web && cypress-parallel -s test:browser -t 4 -d cypress/e2e -a '\"--quiet\"'",
"test:browser": "cypress run --headless",
Expand Down

0 comments on commit c13f1ab

Please sign in to comment.