test: simplify deno workflow for v2.x #115
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: test | |
| on: [ push, pull_request ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test ${{ matrix.package-manager }} on macos-latest | |
| strategy: | |
| matrix: | |
| package-manager: [ "npm", "yarn", "yarn-berry", "pnpm", "deno" ] | |
| # zsh is pre-installed on macos-latest | |
| # https://github.com/actions/runner-images/issues/264 | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Setup Deno | |
| if: matrix.package-manager == 'deno' | |
| uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: 'v2.x' | |
| - name: Enable corepack | |
| # https://github.com/nodejs/corepack/issues/612 | |
| if: matrix.package-manager != 'deno' | |
| run: npm install -g corepack && corepack enable | |
| - name: Test | |
| shell: zsh {0} | |
| run: | | |
| set -e | |
| # enable compinit before loading | |
| autoload -Uz compinit && compinit | |
| # load ni.zsh | |
| source ./ni.zsh | |
| # move to test dir | |
| cd test/${{ matrix.package-manager }} | |
| # Install dependencies | |
| if [ "${{ matrix.package-manager }}" = "deno" ]; then | |
| # Run tests and scripts | |
| ni test | |
| ni run main | |
| # Test package management with both JSR and npm packages | |
| ni add jsr:@std/[email protected] | |
| ni add npm:[email protected] | |
| ni remove npm:chalk | |
| ni remove jsr:@std/path | |
| else | |
| ni | |
| ni test | |
| ni run main | |
| ni exec envinfo | |
| ni add lodash | |
| ni remove lodash | |
| fi |