💚 Fix the use of bash
for Windows
#16
This file contains 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: CI | |
on: ['push', 'pull_request'] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
experimental: [false] | |
runtime: [node, deno, bun] | |
version: ["latest"] | |
pm: [npm, pnpm, yarn] | |
exclude: | |
- runtime: bun | |
pm: pnpm | |
- runtime: bun | |
pm: yarn | |
- runtime: deno | |
pm: pnpm | |
- runtime: deno | |
pm: yarn | |
name: 👷 Panam CI on ${{ matrix.runtime }}-${{ matrix.version }} under ${{ matrix.os }} using ${{ matrix.pm }} | |
timeout-minutes: 60 | |
steps: | |
- name: 🚚 Checkout repository | |
uses: actions/checkout@v4 | |
- name: 🐳 Set up Node.js | |
if: matrix.runtime == 'node' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version }} | |
- name: 🦕 Set up Deno | |
if: matrix.runtime == 'deno' | |
uses: denoland/setup-deno@v2 | |
with: | |
deno-version: ${{ matrix.version }} | |
- name: 🍞 Set up Bun | |
if: matrix.runtime == 'bun' | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: ${{ matrix.version }} | |
- name: 📦 Install dependencies | |
run: | | |
if [[ "${{ matrix.runtime }}" == "node" ]]; then | |
echo "⚙️ Installing ${{ matrix.pm }} dependencies" | |
if [[ "${{ matrix.pm }}" == "yarn" ]]; then | |
YARN_VERSION=$(yarn --version) | |
jq ".packageManager = \"yarn@$YARN_VERSION\"" package.json > yarn-package.json | |
mv package.json main-package.json | |
mv yarn-package.json package.json | |
fi | |
corepack enable | |
corepack prepare ${{ matrix.pm }}@latest --activate | |
if [[ "${{ matrix.pm }}" == "npm" ]]; then | |
npm install --legacy-peer-deps | |
else | |
${{ matrix.pm }} install | |
fi | |
elif [[ "${{ matrix.runtime }}" == "deno" ]]; then | |
echo "⚙️ Installing Deno dependencies" | |
deno install | |
elif [[ "${{ matrix.runtime }}" == "bun" ]]; then | |
echo "⚙️ Installing Bun dependencies" | |
bun install | |
fi | |
shell: bash | |
- name: 🔍 Run tests | |
run: | | |
echo "🧪 Running tests for ${{ matrix.runtime }}..." | |
if [[ "${{ matrix.runtime }}" == "node" ]]; then | |
${{ matrix.pm }} run test | |
elif [[ "${{ matrix.runtime }}" == "deno" ]]; then | |
deno task test | |
elif [[ "${{ matrix.runtime }}" == "bun" ]]; then | |
bun run test | |
fi | |
shell: bash | |
- name: 🎉 CI completed successfully! | |
run: | | |
echo "✅ All tests passed for ${{ matrix.runtime }} on ${{ matrix.os }} using ${{ matrix.pm }}!" | |
if [[ "${{ matrix.pm }}" == "yarn" ]]; then | |
mv main-package.json package.json | |
fi | |
shell: bash |