|
| 1 | +name: Integration |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + |
| 8 | +jobs: |
| 9 | + check-changes: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + changed: ${{ steps.filter.outputs.changed }} |
| 13 | + changed_files: ${{ steps.filter.outputs.changed_files }} |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Node.js |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: '20.x' |
| 22 | + |
| 23 | + - name: Check for changes in .ts and .tsx files |
| 24 | + id: filter |
| 25 | + uses: dorny/paths-filter@v3 |
| 26 | + with: |
| 27 | + list-files: csv |
| 28 | + filters: | |
| 29 | + changed: |
| 30 | + - 'src/**/*.ts' |
| 31 | + - 'src/**/*.tsx' |
| 32 | +
|
| 33 | + verify-documentation: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: check-changes |
| 36 | + if: ${{ needs.check-changes.outputs.changed == 'true' }} |
| 37 | + steps: |
| 38 | + - name: Checkout code |
| 39 | + uses: actions/checkout@v4 |
| 40 | + |
| 41 | + - name: Verify documentation exists |
| 42 | + run: | |
| 43 | + for file in $(echo "${{ needs.check-changes.outputs.changed_files }}" | tr ',' '\n'); do |
| 44 | + if [[ "$file" != *.ts && "$file" != *.tsx ]]; then |
| 45 | + continue |
| 46 | + fi |
| 47 | + dir_name=$(basename $(dirname "$file")) |
| 48 | + base_name=$(basename "${file%.*}") |
| 49 | + if [ "$dir_name" != "$base_name" ]; then |
| 50 | + continue |
| 51 | + fi |
| 52 | + doc_file="$(dirname "$file")/$base_name.md" |
| 53 | + if [ ! -f "$doc_file" ]; then |
| 54 | + echo "Documentation missing for $file" |
| 55 | + exit 1 |
| 56 | + fi |
| 57 | + done |
| 58 | +
|
| 59 | + verify-test: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + needs: check-changes |
| 62 | + if: ${{ needs.check-changes.outputs.changed == 'true' }} |
| 63 | + steps: |
| 64 | + - name: Checkout code |
| 65 | + uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Set up Node.js |
| 68 | + uses: actions/setup-node@v4 |
| 69 | + with: |
| 70 | + node-version: '20.x' |
| 71 | + |
| 72 | + - name: Verify and run tests with coverage |
| 73 | + run: | |
| 74 | + corepack enable |
| 75 | + yarn install |
| 76 | +
|
| 77 | + for file in $(echo "${{ needs.check-changes.outputs.changed_files }}" | tr ',' '\n'); do |
| 78 | + if [[ "$file" != *.ts && "$file" != *.tsx ]]; then |
| 79 | + continue |
| 80 | + fi |
| 81 | + dir_name=$(basename $(dirname "$file")) |
| 82 | + base_name=$(basename "${file%.*}") |
| 83 | + if [ "$dir_name" != "$base_name" ]; then |
| 84 | + continue |
| 85 | + fi |
| 86 | + test_file="$(dirname "$file")/$base_name.spec.ts" |
| 87 | + if [ ! -f "$test_file" ]; then |
| 88 | + test_file="$(dirname "$file")/$base_name.spec.tsx" |
| 89 | + if [ ! -f "$test_file" ]; then |
| 90 | + echo "Test file missing for $file" |
| 91 | + exit 1 |
| 92 | + fi |
| 93 | + fi |
| 94 | + yarn run test:coverage $test_file |
| 95 | + done |
| 96 | +
|
| 97 | + verify-jsdoc: |
| 98 | + runs-on: ubuntu-latest |
| 99 | + needs: check-changes |
| 100 | + if: ${{ needs.check-changes.outputs.changed == 'true' }} |
| 101 | + steps: |
| 102 | + - name: Checkout code |
| 103 | + uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - name: Check for JSDoc comments |
| 106 | + run: | |
| 107 | + for file in $(echo "${{ needs.check-changes.outputs.changed_files }}" | tr ',' '\n'); do |
| 108 | + if [[ "$file" != *.ts && "$file" != *.tsx ]]; then |
| 109 | + continue |
| 110 | + fi |
| 111 | + dir_name=$(basename $(dirname "$file")) |
| 112 | + base_name=$(basename "${file%.*}") |
| 113 | + if [ "$dir_name" != "$base_name" ]; then |
| 114 | + continue |
| 115 | + fi |
| 116 | + if ! grep -q "/**" "$file"; then |
| 117 | + echo "JSDoc comments missing in $file" |
| 118 | + exit 1 |
| 119 | + fi |
| 120 | + done |
0 commit comments