Fix error when visiting 'Groups' tab in security #95
Workflow file for this run
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: Lint, Test & Release | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
commitlint: | |
name: Lint commits | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Install dependencies | |
run: npm install --global @commitlint/{cli,config-conventional} | |
- name: Lint commit | |
if: github.event_name == 'push' | |
run: npx commitlint --from HEAD~1 --to HEAD --verbose --extends @commitlint/config-conventional | |
- name: Lint commits | |
if: github.event_name == 'pull_request' | |
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose --extends @commitlint/config-conventional | |
codelint: | |
name: Lint code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Use PHP 8.1 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
tools: composer:v2 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-php8.1-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer-php8.1- | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-interaction --no-scripts --no-plugins | |
- name: Lint code | |
run: composer run-script lint | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
needs: | |
- commitlint | |
- codelint | |
env: | |
DB: mysql | |
strategy: | |
matrix: | |
php_version: ['8.1'] | |
services: | |
mysql: | |
image: mysql:5.7-debian | |
env: | |
MYSQL_DATABASE: test_database | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_USER: admin | |
MYSQL_ALLOW_EMPTY_PASSWORD: 1 | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Use PHP ${{ matrix.php_version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php_version }} | |
tools: composer:v2 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-php${{ matrix.php_version }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer-php${{ matrix.php_version }}- | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-interaction --no-scripts --no-plugins | |
- name: Test code | |
run: composer run-script test | |
release: | |
name: Release | |
concurrency: release | |
if: ${{ github.event_name == 'push' && github.actor != 'dependabot[bot]' && github.repository_owner == 'dhensby' }} | |
runs-on: ubuntu-latest | |
needs: | |
- commitlint | |
- codelint | |
- test | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "lts/*" | |
- name: Install dependencies | |
run: npm install --global @commitlint/{cli@17,config-conventional@17} semantic-release@21 @semantic-release/{changelog@6,commit-analyzer@10,git@10,github@9,release-notes-generator@11} conventional-changelog-conventionalcommits@6 | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release |