1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-16 01:10:30 +02:00
simple-icons/.github/workflows/verify.yml

100 lines
2.9 KiB
YAML
Raw Normal View History

name: Verify Source
on:
pull_request:
push:
branches:
- master
- develop
jobs:
2021-05-29 18:00:40 +02:00
build:
name: Build package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
2024-05-02 23:24:43 +02:00
- name: Use Node.js
2024-03-09 18:28:21 +02:00
uses: actions/setup-node@v4
2021-05-29 18:00:40 +02:00
with:
2024-05-02 23:24:43 +02:00
node-version: 22
2024-03-09 18:28:21 +02:00
cache: npm
cache-dependency-path: '**/package.json'
2021-05-29 18:00:40 +02:00
- name: Install dependencies
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
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
2024-05-02 23:24:43 +02:00
- name: Use Node.js
2024-03-09 18:28:21 +02:00
uses: actions/setup-node@v4
with:
2024-05-02 23:24:43 +02:00
node-version: 22
2024-03-09 18:28:21 +02:00
cache: npm
cache-dependency-path: '**/package.json'
- name: Detect changed files
2024-03-09 18:28:21 +02:00
uses: dorny/paths-filter@v3
id: changes
with:
list-files: shell
filters: |
docs:
- '*.md'
- '.github/**.md'
icons:
- 'icons/*.svg'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Run linter
run: |
sed -i 's/icons\/\*\.svg/$npm_config_icons/' package.json
npm run lint --icons='${{ steps.changes.outputs.icons_files }}'
env:
# Authorise GitHub API requests for editorconfig-checker
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check documentation links
if: steps.changes.outputs.docs == true
run: |
npx markdown-link-check --retry \
--config .github/markdown-link-check.json \
${{ steps.changes.outputs.docs_files }}
continue-on-error: ${{ github.ref == 'refs/heads/develop' }}
- 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
test:
name: Test package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
2024-05-02 23:24:43 +02:00
- name: Use Node.js
2024-03-09 18:28:21 +02:00
uses: actions/setup-node@v4
with:
2024-05-02 23:24:43 +02:00
node-version: 22
2024-03-09 18:28:21 +02:00
cache: npm
cache-dependency-path: '**/package.json'
- name: Install dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Run tests
run: npm run test