Merge pull request #2241 from vrk-kpa/dependabot/npm_and_yarn/braces-… #2573
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |