-
Notifications
You must be signed in to change notification settings - Fork 12
108 lines (100 loc) · 3.32 KB
/
check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Code Quality Checks
on:
push:
branches:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
ruff:
name: ruff
runs-on: ubuntu-latest
container: python:3.11
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install requirements
run: |
pip install ruff
- name: Run ruff
run: |
ruff check --output-format=github ckan
code-sniffer:
name: code-sniffer
runs-on: ubuntu-latest
container: php:8.3
steps:
- uses: actions/checkout@v4
- name: Install Composer
run: |
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
mv composer.phar /usr/local/bin/composer
exit $RESULT
shell: sh
- name: Set up environment
run : |
apt-get update && apt-get install -y zlib1g-dev libsqlite3-dev libpng-dev libzip-dev unzip git
docker-php-ext-install gd
- run: php -d memory_limit=-1 /usr/local/bin/composer install -n --prefer-dist
working-directory: ./drupal/
- name: Ignore warnings on exit code
run: ./vendor/bin/phpcs --config-set ignore_warnings_on_exit 1
working-directory: ./drupal/
- name: Run codesniffer for drupal standard
run: ./vendor/bin/phpcs --standard=Drupal modules --ignore=*\.js
working-directory: ./drupal
- name: Run codesniffer for drupal practice
run: ./vendor/bin/phpcs --standard=DrupalPractice modules --ignore=*\.js
working-directory: ./drupal
stylelint:
name: stylelint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: opendata-assets/package-lock.json
- name: Authenticate npm registry
if: ${{ steps.cache-node_modules.outputs.cache-hit != 'true' }}
run: |
cat <<EOT >> .npmrc
@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=$NPM_TOKEN
EOT
working-directory: ./opendata-assets
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: install npm packages
run: npm ci
working-directory: ./opendata-assets
- name: run stylelint
run: npx stylelint "src/less" -f github
working-directory: ./opendata-assets
slack:
name: Slack notification
runs-on: ubuntu-latest
needs:
- ruff
- code-sniffer
- stylelint
if: failure() && github.ref == 'refs/heads/master'
steps:
- uses: 8398a7/action-slack@v3
with:
status: 'failure'
fields: repo,message,author,action,ref
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEB_HOOK }}