|
| 1 | +# Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. |
| 2 | +# Documentation: https://docs.github.com/en/actions |
| 3 | + |
| 4 | +name: build |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - develop |
| 11 | + - release/* |
| 12 | + pull_request: |
| 13 | + branches: |
| 14 | + - main |
| 15 | + - develop |
| 16 | + |
| 17 | +jobs: |
| 18 | + lint: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + node-version: [16] |
| 24 | + |
| 25 | + steps: |
| 26 | + |
| 27 | + |
| 28 | + - name: Use Node.js ${{ matrix.node-version }} |
| 29 | + |
| 30 | + with: |
| 31 | + node-version: ${{ matrix.node-version }} |
| 32 | + |
| 33 | + - name: Load cached dependencies |
| 34 | + |
| 35 | + id: cache |
| 36 | + with: |
| 37 | + path: | |
| 38 | + **/node_modules |
| 39 | + /home/runner/.cache/Cypress |
| 40 | + key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + id: install-dependencies |
| 44 | + if: steps.cache.outputs.cache-hit != 'true' |
| 45 | + run: npm install |
| 46 | + |
| 47 | + # - name: Fix code style linting errors |
| 48 | + # id: lint-fix |
| 49 | + # run: npm run lint:fix |
| 50 | + # continue-on-error: true |
| 51 | + # |
| 52 | + # - name: Commit fixed linting errors |
| 53 | + # id: commit |
| 54 | + # uses: stefanzweifel/git-auto-commit-action@v4 |
| 55 | + # with: |
| 56 | + # commit_message: "ci: fix code style linting errors" |
| 57 | + |
| 58 | + - name: Lint code |
| 59 | + id: lint |
| 60 | + run: npm run lint |
| 61 | + |
| 62 | + test: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + |
| 65 | + strategy: |
| 66 | + matrix: |
| 67 | + node-version: [16] |
| 68 | + test-spec: |
| 69 | + - { name: "Integration", spec: "./tests/cypress/integration/**/*.spec.{js,ts}" } |
| 70 | + #- { name: "Demos/Commands", spec: "./demos/src/Commands/**/*.spec.{js,ts}" } |
| 71 | + - { name: "Demos/Examples", spec: "./demos/src/Examples/**/*.spec.{js,ts}" } |
| 72 | + - { name: "Demos/Experiments", spec: "./demos/src/Experiments/**/*.spec.{js,ts}" } |
| 73 | + - { name: "Demos/Extensions", spec: "./demos/src/Extensions/**/*.spec.{js,ts}" } |
| 74 | + - { name: "Demos/GuideContent", spec: "./demos/src/GuideContent/**/*.spec.{js,ts}" } |
| 75 | + - { name: "Demos/GuideGettingStarted", spec: "./demos/src/GuideGettingStarted/**/*.spec.{js,ts}" } |
| 76 | + #- { name: "Demos/GuideNodeViews", "./demos/src/GuideNodeViews/**/*.spec.{js,ts}" } |
| 77 | + - { name: "Demos/Marks", spec: "./demos/src/Marks/**/*.spec.{js,ts}" } |
| 78 | + - { name: "Demos/Nodes", spec: "./demos/src/Nodes/**/*.spec.{js,ts}" } |
| 79 | + #- { name: "Demos/Overview", spec: "./demos/src/Overview/**/*.spec.{js,ts}" } |
| 80 | + |
| 81 | + steps: |
| 82 | + |
| 83 | + |
| 84 | + - name: Use Node.js ${{ matrix.node-version }} |
| 85 | + |
| 86 | + with: |
| 87 | + node-version: ${{ matrix.node-version }} |
| 88 | + |
| 89 | + - name: Install dependencies |
| 90 | + id: install-dependencies |
| 91 | + run: npm install |
| 92 | + |
| 93 | + - name: Try to build the packages |
| 94 | + id: build-packages |
| 95 | + run: npm run build:pm |
| 96 | + |
| 97 | + - name: Test ${{ matrix.test-spec.name }} |
| 98 | + id: cypress |
| 99 | + uses: cypress-io/[email protected] |
| 100 | + with: |
| 101 | + cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} |
| 102 | + start: npm run start |
| 103 | + wait-on: 'http://localhost:3000' |
| 104 | + spec: ${{ matrix.test-spec.spec }} |
| 105 | + project: ./tests |
| 106 | + browser: chrome |
| 107 | + quiet: true |
| 108 | + |
| 109 | + - name: Export screenshots (on failure only) |
| 110 | + |
| 111 | + if: failure() |
| 112 | + with: |
| 113 | + name: cypress-screenshots |
| 114 | + path: tests/cypress/screenshots |
| 115 | + retention-days: 7 |
| 116 | + |
| 117 | + - name: Export screen recordings (on failure only) |
| 118 | + |
| 119 | + if: failure() |
| 120 | + with: |
| 121 | + name: cypress-videos |
| 122 | + path: tests/cypress/videos |
| 123 | + retention-days: 7 |
| 124 | + |
| 125 | + build: |
| 126 | + runs-on: ubuntu-latest |
| 127 | + |
| 128 | + needs: lint |
| 129 | + |
| 130 | + strategy: |
| 131 | + matrix: |
| 132 | + node-version: [16] |
| 133 | + |
| 134 | + steps: |
| 135 | + |
| 136 | + |
| 137 | + - name: Use Node.js ${{ matrix.node-version }} |
| 138 | + |
| 139 | + with: |
| 140 | + node-version: ${{ matrix.node-version }} |
| 141 | + |
| 142 | + - name: Load cached dependencies |
| 143 | + |
| 144 | + id: cache |
| 145 | + with: |
| 146 | + path: | |
| 147 | + **/node_modules |
| 148 | + /home/runner/.cache/Cypress |
| 149 | + key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} |
| 150 | + |
| 151 | + - name: Install dependencies |
| 152 | + id: install-dependencies |
| 153 | + if: steps.cache.outputs.cache-hit != 'true' |
| 154 | + run: npm install |
| 155 | + |
| 156 | + - name: Try to build the packages |
| 157 | + id: build-packages |
| 158 | + run: npm run build:ci |
0 commit comments