2021-04-08 02:15:11 +02:00
|
|
|
name: Verify Source
|
2024-05-03 00:51:07 +02:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
2020-11-28 11:34:36 +01:00
|
|
|
|
|
|
|
jobs:
|
2021-05-29 18:00:40 +02:00
|
|
|
build:
|
|
|
|
name: Build package
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-22 14:03:01 +08:00
|
|
|
uses: actions/checkout@v4
|
2024-05-03 05:24:43 +08:00
|
|
|
- name: Use Node.js
|
2024-03-09 17:28:21 +01:00
|
|
|
uses: actions/setup-node@v4
|
2021-05-29 18:00:40 +02:00
|
|
|
with:
|
2024-07-23 09:56:39 +08:00
|
|
|
node-version: 22
|
2024-03-09 17:28:21 +01:00
|
|
|
cache: npm
|
|
|
|
cache-dependency-path: '**/package.json'
|
2021-05-29 18:00:40 +02:00
|
|
|
- name: Install dependencies
|
2024-03-18 22:27:08 +01:00
|
|
|
run: npm i --ignore-scripts --no-audit --no-fund
|
2021-05-29 18:00:40 +02:00
|
|
|
- name: Build NodeJS package
|
|
|
|
run: npm run build
|
2020-11-28 11:34:36 +01:00
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-01-15 21:47:00 +01:00
|
|
|
- name: Checkout
|
2023-09-22 14:03:01 +08:00
|
|
|
uses: actions/checkout@v4
|
2024-05-03 05:24:43 +08:00
|
|
|
- name: Use Node.js
|
2024-03-09 17:28:21 +01:00
|
|
|
uses: actions/setup-node@v4
|
2021-06-29 12:07:50 +02:00
|
|
|
with:
|
2024-07-23 09:56:39 +08:00
|
|
|
node-version: 22
|
2024-03-09 17:28:21 +01:00
|
|
|
cache: npm
|
|
|
|
cache-dependency-path: '**/package.json'
|
2024-03-09 17:36:18 +01:00
|
|
|
- name: Detect changed files
|
2024-03-09 17:28:21 +01:00
|
|
|
uses: dorny/paths-filter@v3
|
2023-08-10 09:25:53 -06:00
|
|
|
id: changes
|
|
|
|
with:
|
|
|
|
list-files: shell
|
|
|
|
filters: |
|
|
|
|
docs:
|
2024-11-17 21:52:51 +01:00
|
|
|
- '*!(slugs).md'
|
2023-08-10 09:25:53 -06:00
|
|
|
- '.github/**.md'
|
2024-03-09 17:36:18 +01:00
|
|
|
icons:
|
|
|
|
- 'icons/*.svg'
|
2024-11-17 21:52:51 +01:00
|
|
|
slugs:
|
|
|
|
- 'slugs.md'
|
2024-11-26 04:04:33 +01:00
|
|
|
sdkts:
|
|
|
|
- 'sdk.d.ts'
|
2024-03-09 17:36:18 +01:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2024-11-17 21:52:51 +01:00
|
|
|
- name: Don't edit slugs.md in pull requests
|
|
|
|
if: |
|
2024-11-24 09:50:11 +08:00
|
|
|
github.base_ref != 'master' &&
|
2024-11-17 21:52:51 +01:00
|
|
|
github.event_name == 'pull_request' &&
|
|
|
|
steps.changes.outputs.slugs == 'true'
|
|
|
|
run: |
|
|
|
|
echo -ne "Detected slugs.md file edition in PR.\n" 1>&2
|
|
|
|
echo -ne "Please revert it, we build the slugs.md" 1>&2
|
|
|
|
echo -ne " file automatically at releases.\n" 1>&2
|
|
|
|
exit 1
|
2024-11-26 04:04:33 +01:00
|
|
|
- name: Don't edit sdk.d.ts in pull requests
|
|
|
|
if: |
|
|
|
|
github.base_ref != 'master' &&
|
|
|
|
github.event_name == 'pull_request' &&
|
|
|
|
steps.changes.outputs.sdkts == 'true'
|
|
|
|
run: |
|
|
|
|
echo -ne "Detected sdk.d.ts file edition in PR.\n" 1>&2
|
|
|
|
echo -ne "Please revert it, we build the sdk.d.ts" 1>&2
|
|
|
|
echo -ne " file automatically at releases.\n" 1>&2
|
|
|
|
exit 1
|
2024-03-09 17:36:18 +01:00
|
|
|
- name: Install dependencies
|
2024-03-18 22:27:08 +01:00
|
|
|
run: npm i --ignore-scripts --no-audit --no-fund
|
2024-03-09 17:36:18 +01:00
|
|
|
- name: Run linter
|
2024-03-29 17:06:38 +01:00
|
|
|
run: |
|
|
|
|
sed -i 's/icons\/\*\.svg/$npm_config_icons/' package.json
|
|
|
|
npm run lint --icons='${{ steps.changes.outputs.icons_files }}'
|
2024-03-09 17:36:18 +01:00
|
|
|
env:
|
|
|
|
# Authorise GitHub API requests for editorconfig-checker
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-08-10 09:25:53 -06:00
|
|
|
- name: Check documentation links
|
2024-10-13 18:55:51 +02:00
|
|
|
if: steps.changes.outputs.docs == 'true'
|
2024-10-13 04:31:07 +02:00
|
|
|
uses: lycheeverse/lychee-action@v2
|
|
|
|
with:
|
2024-10-14 02:23:50 +08:00
|
|
|
args: -- ${{ steps.changes.outputs.docs_files }}
|
2024-10-13 04:31:07 +02:00
|
|
|
fail: ${{ github.ref != 'refs/heads/develop' }}
|
2024-10-27 09:06:47 +08:00
|
|
|
failIfEmpty: false
|
2024-10-13 04:31:07 +02:00
|
|
|
jobSummary: true
|
|
|
|
format: markdown
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2021-08-04 10:23:20 +02:00
|
|
|
- name: Verify file permissions
|
|
|
|
run: |
|
|
|
|
CHECK_DIRS="icons/ _data/"
|
|
|
|
echo "Searching the following directories for executable files:"
|
|
|
|
echo "${CHECK_DIRS}"
|
|
|
|
echo ""
|
|
|
|
EXE_FILES=$(find ${CHECK_DIRS} -type f -executable)
|
|
|
|
if test -n "${EXE_FILES-}"
|
|
|
|
then
|
|
|
|
echo "Some files were detected to have their executable bit set."
|
|
|
|
echo "To fix this, you can use 'chmod -x PATH/TO/FILE' on the following files:"
|
|
|
|
echo ""
|
|
|
|
echo "${EXE_FILES}"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "All clear."
|
|
|
|
exit 0
|
|
|
|
fi
|
2020-11-28 11:34:36 +01:00
|
|
|
test:
|
|
|
|
name: Test package
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-01-15 21:47:00 +01:00
|
|
|
- name: Checkout
|
2023-09-22 14:03:01 +08:00
|
|
|
uses: actions/checkout@v4
|
2024-05-03 05:24:43 +08:00
|
|
|
- name: Use Node.js
|
2024-03-09 17:28:21 +01:00
|
|
|
uses: actions/setup-node@v4
|
2021-06-29 12:07:50 +02:00
|
|
|
with:
|
2024-07-23 09:56:39 +08:00
|
|
|
node-version: 22
|
2024-03-09 17:28:21 +01:00
|
|
|
cache: npm
|
|
|
|
cache-dependency-path: '**/package.json'
|
2021-01-15 21:47:00 +01:00
|
|
|
- name: Install dependencies
|
2024-03-18 22:27:08 +01:00
|
|
|
run: npm i --ignore-scripts --no-audit --no-fund
|
2021-01-15 21:47:00 +01:00
|
|
|
- name: Run tests
|
|
|
|
run: npm run test
|