Skip to content

Commit

Permalink
Replace appveyor & circleci with flowzone
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
thgreasi committed Apr 9, 2024
1 parent 838b3e3 commit 65a1372
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 110 deletions.
50 changes: 50 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: "Test custom"
description: "Custom test step to run during a pull request"
# this inputs are always provided by flowzone, so they must always be defined on the composite action
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true
runs:
using: "composite"
steps:
- name: Setup Node.js 18
if: ${{ fromJSON(env.os_value)[0] == 'ubuntu-20.04' }}
uses: actions/setup-node@v3
with:
node-version: 18

- name: Setup Node.js lts
if: ${{ fromJSON(env.os_value)[0] != 'ubuntu-20.04' }}
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Install dependencies
shell: bash
run: |
if [ -e package-lock.json ]; then
npm ci
else
npm i
fi
- name: Run custom node tests
shell: bash
run: |
# os_value is a JSON array of runner labels but we are only looking at the first element
echo "OS: ${{ fromJSON(env.os_value)[0] }}"
node -v
npm -v
export TEST_EMAIL_KEY=${{ format('TEST_EMAIL{0}', fromJSON('{"windows-2019":"","ubuntu-20.04":"_1","macos-12":"_2"}')[fromJSON(env.os_value)[0]]) }}
export TEST_EMAIL=${{ fromJSON(inputs.secrets)[ format('TEST_EMAIL{0}', fromJSON('{"windows-2019":"","ubuntu-20.04":"_1","macos-12":"_2"}')[fromJSON(env.os_value)[0]]) ] }}
export TEST_PASSWORD=${{ fromJSON(inputs.secrets).TEST_PASSWORD }}
echo "TEST_EMAIL_KEY: [ ${TEST_EMAIL_KEY} ]"
echo "TEST_EMAIL: [ ${TEST_EMAIL} ]"
npm test
23 changes: 23 additions & 0 deletions .github/workflows/flowzone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Flowzone

on:
pull_request:
types: [opened, synchronize, closed]
branches: [main, master]
# allow external contributions to use secrets within trusted code
pull_request_target:
types: [opened, synchronize, closed]
branches: [main, master]

jobs:
flowzone:
name: Flowzone
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
# prevent duplicate workflows and only allow one `pull_request` or `pull_request_target` for
# internal or external contributions respectively
if: |
(github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request') ||
(github.event.pull_request.head.repo.full_name != github.repository && github.event_name == 'pull_request_target')
secrets: inherit
with:
custom_runs_on: '[["windows-2019"],["ubuntu-20.04"],["macos-12"]]'
24 changes: 0 additions & 24 deletions appveyor.yml

This file was deleted.

84 changes: 0 additions & 84 deletions circle.yml

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"scripts": {
"build": "gulp build && npm run readme",
"pretest": "npm run build",
"test": "gulp test && coffee tests/e2e.coffee",
"test": "([ \"$GITHUB_WORKFLOW\" = 'Flowzone' ] && [ \"$GITHUB_JOB\" = 'npm_test' ] && echo \"Skipping 'npm test' in flowzone in favor of the custom test action!\") || (npm run build && npm run test:all)",
"test:all": "gulp test && coffee tests/e2e.coffee",
"prepare": "npm run build",
"readme": "jsdoc2md --template doc/README.hbs build/init.js > README.md"
},
Expand Down

0 comments on commit 65a1372

Please sign in to comment.