|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: JS |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 16 | + browser: [chrome-headless, firefox-headless] |
| 17 | + exclude: |
| 18 | + # macos and firefox-headless seems to consistently fail. |
| 19 | + - os: macos-latest |
| 20 | + browser: firefox-headless |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - name: Set up Node |
| 25 | + uses: actions/setup-node@v1 |
| 26 | + with: |
| 27 | + node-version: '14.x' |
| 28 | + |
| 29 | + # Cache yarn |
| 30 | + - name: Get yarn cache directory path |
| 31 | + id: yarn-cache-dir-path |
| 32 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 33 | + - name: Cache yarn |
| 34 | + uses: actions/cache@v2 |
| 35 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 36 | + with: |
| 37 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 38 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 39 | + restore-keys: | |
| 40 | + ${{ runner.os }}-yarn- |
| 41 | +
|
| 42 | + - name: Install dependencies |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + set -eux |
| 46 | + npm install -g yarn |
| 47 | + yarn |
| 48 | +
|
| 49 | + - name: Build Source |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + set -eux |
| 53 | + yarn build |
| 54 | + yarn build:test |
| 55 | +
|
| 56 | + - name: Run Tests |
| 57 | + run: | |
| 58 | + yarn run test:${{ matrix.browser }} |
| 59 | +
|
| 60 | + build: |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v2 |
| 64 | + - name: Set up Node |
| 65 | + uses: actions/setup-node@v1 |
| 66 | + with: |
| 67 | + node-version: '14.x' |
| 68 | + |
| 69 | + # Cache yarn |
| 70 | + - name: Get yarn cache directory path |
| 71 | + id: yarn-cache-dir-path |
| 72 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 73 | + - name: Cache yarn |
| 74 | + uses: actions/cache@v2 |
| 75 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 76 | + with: |
| 77 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 78 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 79 | + restore-keys: | |
| 80 | + ${{ runner.os }}-yarn- |
| 81 | +
|
| 82 | + - name: Install dependencies |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + set -eux |
| 86 | + npm install -g yarn |
| 87 | + yarn |
| 88 | +
|
| 89 | + - name: Check linters |
| 90 | + shell: bash |
| 91 | + run: | |
| 92 | + set -eux |
| 93 | + yarn lint:check |
| 94 | +
|
| 95 | + - name: Build Source |
| 96 | + shell: bash |
| 97 | + run: | |
| 98 | + set -eux |
| 99 | + yarn build |
| 100 | + yarn build:test |
| 101 | +
|
| 102 | + - name: Test Examples |
| 103 | + shell: bash |
| 104 | + run: | |
| 105 | + set -eux |
| 106 | + yarn minimize |
| 107 | + yarn build:examples |
| 108 | + yarn test:examples |
| 109 | +
|
| 110 | + - name: Build Docs |
| 111 | + run: | |
| 112 | + set -eux |
| 113 | + yarn clean |
| 114 | + yarn docs |
| 115 | +
|
| 116 | + - name: Publish with Verdaccio |
| 117 | + run: | |
| 118 | + set -eux |
| 119 | + npm install -g verdaccio |
| 120 | + verdaccio --config .github/scripts/verdaccio.yml & |
| 121 | + npm set registry http://localhost:4873/ |
| 122 | + yarn config set registry http://localhost:4873/ |
| 123 | + git config --global user.email "[email protected]" |
| 124 | + git config --global user.name "Your Name" |
| 125 | + yarn run update:versions patch --yes |
| 126 | + git commit -a -m "Update versions" |
| 127 | + yarn run publish |
| 128 | +
|
| 129 | + check_release: |
| 130 | + runs-on: ubuntu-latest |
| 131 | + strategy: |
| 132 | + matrix: |
| 133 | + group: [check_release, link_check] |
| 134 | + steps: |
| 135 | + - name: Checkout |
| 136 | + uses: actions/checkout@v2 |
| 137 | + |
| 138 | + - name: Set up Node |
| 139 | + uses: actions/setup-node@v1 |
| 140 | + with: |
| 141 | + node-version: '14.x' |
| 142 | + |
| 143 | + - name: Install Python |
| 144 | + uses: actions/setup-python@v2 |
| 145 | + with: |
| 146 | + python-version: 3.9 |
| 147 | + architecture: "x64" |
| 148 | + |
| 149 | + # Cache pip |
| 150 | + - name: Get Date |
| 151 | + id: get-date |
| 152 | + run: | |
| 153 | + echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" |
| 154 | + shell: bash |
| 155 | + |
| 156 | + - name: Get pip cache dir |
| 157 | + id: pip-cache |
| 158 | + run: | |
| 159 | + echo "::set-output name=dir::$(pip cache dir)" |
| 160 | +
|
| 161 | + - name: Cache pip |
| 162 | + uses: actions/cache@v2 |
| 163 | + with: |
| 164 | + path: ${{ steps.pip-cache.outputs.dir }} |
| 165 | + key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }} |
| 166 | + restore-keys: | |
| 167 | + ${{ runner.os }}-pip- |
| 168 | + ${{ runner.os }}-pip- |
| 169 | +
|
| 170 | + # Cache yarn |
| 171 | + - name: Get yarn cache directory path |
| 172 | + id: yarn-cache-dir-path |
| 173 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 174 | + - name: Cache yarn |
| 175 | + uses: actions/cache@v2 |
| 176 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 177 | + with: |
| 178 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 179 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 180 | + restore-keys: | |
| 181 | + ${{ runner.os }}-yarn- |
| 182 | +
|
| 183 | + - name: Cache checked links |
| 184 | + if: ${{ matrix.group == 'link_check' }} |
| 185 | + uses: actions/cache@v2 |
| 186 | + with: |
| 187 | + path: ~/.cache/pytest-link-check |
| 188 | + key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/*.md') }}-md-links |
| 189 | + restore-keys: | |
| 190 | + ${{ runner.os }}-linkcheck- |
| 191 | +
|
| 192 | + - name: Check Release |
| 193 | + if: ${{ matrix.group == 'check_release' }} |
| 194 | + uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1 |
| 195 | + with: |
| 196 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 197 | + |
| 198 | + - name: Run Link Check |
| 199 | + if: ${{ matrix.group == 'link_check' }} |
| 200 | + uses: jupyter-server/jupyter_releaser/.github/actions/check-links@v1 |
0 commit comments