mirror of
https://github.com/directus/directus.git
synced 2026-01-15 01:18:03 -05:00
113 lines
2.9 KiB
YAML
113 lines
2.9 KiB
YAML
name: Check
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: check-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NODE_OPTIONS: --max_old_space_size=6144
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@v45
|
|
|
|
- name: Prepare
|
|
uses: ./.github/actions/prepare
|
|
with:
|
|
build: false
|
|
|
|
- name: Run Linter
|
|
run: pnpm exec eslint ${{ steps.changed-files.outputs.all_changed_files }}
|
|
|
|
stylelint:
|
|
name: Stylelint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@v45
|
|
|
|
- name: Prepare
|
|
uses: ./.github/actions/prepare
|
|
with:
|
|
build: false
|
|
|
|
- name: Run Stylelinter
|
|
run: pnpm exec stylelint ${{ steps.changed-files.outputs.all_changed_files }} --allow-empty-input
|
|
|
|
format:
|
|
name: Format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@v45
|
|
|
|
- name: Prepare
|
|
uses: ./.github/actions/prepare
|
|
with:
|
|
build: false
|
|
|
|
- name: Run Formatter
|
|
run: pnpm exec prettier --check --ignore-unknown ${{ steps.changed-files.outputs.all_changed_files }}
|
|
|
|
unit:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# This currently builds all packages in the repo. Ideally we add build: false here as well
|
|
# to save minutes building the repo, but that'd require us refactoring the tests to stop
|
|
# using @directus/* packages within tests
|
|
- name: Prepare
|
|
uses: ./.github/actions/prepare
|
|
|
|
- name: Run Tests
|
|
run: pnpm test:coverage --passWithNoTests
|
|
|
|
- name: Upload coverage to Codecov
|
|
run: |
|
|
# Download and install Codecov uploader
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
chmod +x codecov
|
|
|
|
# Find all coverage files and upload them with flags based on folder names
|
|
find . -name "coverage-final.json" -path "*/coverage/*" | while read -r coverage_file; do
|
|
# Extract the folder name that contains the coverage directory
|
|
folder_name=$(echo "$coverage_file" | sed -E 's|.*/(.*)/coverage/.*|\1|')
|
|
echo "Uploading coverage for $folder_name from $coverage_file"
|
|
|
|
# Upload to codecov with folder name as flag
|
|
./codecov upload-coverage -f "$coverage_file" -F "$folder_name" -Z --disable-search
|
|
done
|