Skip to content

Commit

Permalink
other: Add node.js versions matrix to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr-mazepa committed Jul 31, 2023
1 parent c8c1bb7 commit e6117b7
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 22 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
on-pull-request:
name: test
strategy:
matrix:
node-version: [lts/fermium, lts/gallium, lts/hydrogen]
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Print node version
run: node -v

- name: Install dependencies
run: npm ci

- name: Run build
run: npm run build

- if: matrix.node-version == 'lts/hydrogen' # starting from v18 there is FormData implementation in Node.js
name: Run Node.js integration tests with builtin FormData
run: export LAUNCH_TYPE=native && npm run test:node

- name: Run Node.js integration tests with form-data package
run: export LAUNCH_TYPE=native && npm run test:node

- name: Copy dist for test server
run: cp ${{ github.workspace}}/dist/mailgun.web.js ${{ github.workspace}}/integration_tests/server/dist/mailgun.web.js

- name: Serve Files
uses: Eun/http-server-action@v1
with:
directory: ${{ github.workspace}}/integration_tests/server/
port: 3000
no-cache: false
allowed-methods: |
["GET", "HEAD", "POST"]
log: "log.txt"
logTime: "false"

- run: curl -vvvv http://localhost:3000/pages/AMD.html && cat log.txt

- name: Run Browser integration tests
run: export LAUNCH_TYPE=amd && npm run test:browser

- name: Show expected changes in the changelog file
run: npm run release:test
23 changes: 1 addition & 22 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,8 @@ jobs:
- name: Run build
run: npm run build

- name: Run tests
- name: Run TS tests
run: npm test

- name: Run Node.js integration tests
run: export LAUNCH_TYPE=native && npm run test:node

- name: Copy dist for test server
run: cp ${{ github.workspace}}/dist/mailgun.web.js ${{ github.workspace}}/integration_tests/server/dist/mailgun.web.js

- name: Serve Files
uses: Eun/http-server-action@v1
with:
directory: ${{ github.workspace}}/integration_tests/server/
port: 3000
no-cache: false
allowed-methods: |
["GET", "HEAD", "POST"]
log: "log.txt"
logTime: "false"

- run: curl -vvvv http://localhost:3000/pages/AMD.html && cat log.txt
- name: Run Browser integration tests
run: export LAUNCH_TYPE=amd && npm run test:browser

- name: Show expected changes in the changelog file
run: npm run release:test

0 comments on commit e6117b7

Please sign in to comment.