|
| 1 | +# WARNING! Conditionals are set as variables to minimize repetitive checks. |
| 2 | +# However, this results in the variables being the *string* values "true" or "false". |
| 3 | +# As a result, you must always explicitly check for those strings. For example, |
| 4 | +# ${{ env.DEVELOP }} will ALWAYS evaluate as true; to achieve the expected result |
| 5 | +# you must check ${{ env.DEVELOP == 'true' }}. There's probably a better way to DRY, |
| 6 | +# but this is what we have for now. |
| 7 | + |
| 8 | +name: SalesforceCommerceCloud/pwa-kit/lint |
| 9 | +on: |
| 10 | + pull_request: # Default: opened, reopened, synchronize (head branch updated) |
| 11 | + merge_group: # Trigger GA workflow when a pull request is added to a merge queue. |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - develop |
| 15 | + - 'release-*' |
| 16 | + |
| 17 | +jobs: |
| 18 | + pwa-kit-lint: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Setup Node |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version: 22 # Use latest LTS version for linting |
| 28 | + cache: npm |
| 29 | + |
| 30 | + - name: Setup Ubuntu Machine |
| 31 | + uses: "./.github/actions/setup_ubuntu" |
| 32 | + |
| 33 | + - name: Run linting |
| 34 | + uses: "./.github/actions/linting" |
| 35 | + |
| 36 | + generated-project-lint: |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + template: [retail-react-app-test-project, retail-react-app-demo] |
| 41 | + runs-on: ubuntu-latest |
| 42 | + env: |
| 43 | + PROJECT_DIR: generated-${{ matrix.template }} |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Setup Node |
| 49 | + uses: actions/setup-node@v4 |
| 50 | + with: |
| 51 | + node-version: 22 |
| 52 | + cache: npm |
| 53 | + |
| 54 | + - name: Setup Ubuntu Machine |
| 55 | + uses: "./.github/actions/setup_ubuntu" |
| 56 | + |
| 57 | + - name: Generate ${{ matrix.template }} project |
| 58 | + run: |- |
| 59 | + node packages/pwa-kit-create-app/scripts/create-mobify-app-dev.js --outputDir ${{ env.PROJECT_DIR }} |
| 60 | + env: |
| 61 | + GENERATOR_PRESET: ${{ matrix.template }} |
| 62 | + timeout-minutes: 8 |
| 63 | + |
| 64 | + - name: Lint the generated project |
| 65 | + uses: "./.github/actions/linting" |
| 66 | + with: |
| 67 | + cwd: ${{ env.PROJECT_DIR }} |
| 68 | + |
| 69 | + - name: Store Verdaccio logfile artifact |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: verdaccio-log-lint-${{ matrix.template }} |
| 73 | + path: packages/pwa-kit-create-app/local-npm-repo/verdaccio-${{ matrix.template }}.log |
| 74 | + |
| 75 | + generated-project-lint-windows: |
| 76 | + strategy: |
| 77 | + fail-fast: false |
| 78 | + matrix: |
| 79 | + template: [retail-react-app-test-project, retail-react-app-demo] |
| 80 | + runs-on: windows-latest |
| 81 | + env: |
| 82 | + PROJECT_DIR: generated-${{ matrix.template }} |
| 83 | + steps: |
| 84 | + - name: Checkout |
| 85 | + uses: actions/checkout@v4 |
| 86 | + |
| 87 | + - name: Setup Node |
| 88 | + uses: actions/setup-node@v4 |
| 89 | + with: |
| 90 | + node-version: 22 |
| 91 | + cache: npm |
| 92 | + |
| 93 | + - name: Setup Windows Machine |
| 94 | + uses: "./.github/actions/setup_windows" |
| 95 | + |
| 96 | + - name: Generate ${{ matrix.template }} project |
| 97 | + run: |- |
| 98 | + node packages/pwa-kit-create-app/scripts/create-mobify-app-dev.js --outputDir ${{ env.PROJECT_DIR }} |
| 99 | + env: |
| 100 | + GENERATOR_PRESET: ${{ matrix.template }} |
| 101 | + timeout-minutes: 7 |
| 102 | + |
| 103 | + - name: Lint the generated project |
| 104 | + uses: "./.github/actions/linting" |
| 105 | + with: |
| 106 | + cwd: ${{ env.PROJECT_DIR }} |
| 107 | + |
| 108 | + - name: Store Verdaccio logfile artifact |
| 109 | + uses: actions/upload-artifact@v4 |
| 110 | + with: |
| 111 | + name: verdaccio-log-lint-windows-${{ matrix.template }} |
| 112 | + path: packages/pwa-kit-create-app/local-npm-repo/verdaccio-windows-${{ matrix.template }}.log |
| 113 | + |
0 commit comments