Skip to content

ci: add workflows for running vue + nuxt integration tests #3

ci: add workflows for running vue + nuxt integration tests

ci: add workflows for running vue + nuxt integration tests #3

name: Integration Tests
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build package
run: yarn build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vue-mess-detector
retention-days: 1
path: |
./package.json
./dist
./node_modules
./yarn.lock
./index.d.ts
test-create-vue:
runs-on: ${{ matrix.platform }}
needs: build
strategy:
matrix:
platform: [ 'macos-latest', 'ubuntu-latest', 'windows-latest' ]
package-manager: [ npm, yarn, pnpm, bun ]
name: Testing Vue with ${{ matrix.package-manager }} on ${{ matrix.platform }}
steps:
- name: Create directories
run: |
mkdir ./package
mkdir ./test-repo
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vue-mess-detector
path: ./package
- if: matrix.package-manager != 'bun'
name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- if: matrix.package-manager == 'pnpm'
name: Check PNPM
uses: pnpm/action-setup@v4
with:
version: '9.9.0'
- if: matrix.package-manager == 'yarn'
name: Check Yarn
run: |
corepack prepare yarn@stable --activate
yarn set version stable
- if: matrix.package-manager == 'bun'
name: Check Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.1.26'
- if: runner.os != 'Windows'
name: Create and Run Vue Mess Detector (Linux/Mac)
working-directory: ./test-repo
run: |
if [ "${{ matrix.package-manager }}" == "pnpm" ]; then
yes "my-package" | head -n 1 | pnpm create vue@latest . --default --typescript
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "yarn" ]; then
yes "my-package" | head -n 1 | yarn --cwd . create vue . --default --typescript
touch ./yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "bun" ]; then
yes "my-package" | head -n 1 | bun create vue . --default --typescript --cwd=. --ignore-scripts
bun add file:${{ github.workspace }}/package/ --dev
bun install --ignore-scripts
bun run vue-mess-detector analyze --output=json --file-output=vmd-output.json
else
yes "my-package" | head -n 1 | npm create vue@latest -- . --default --typescript
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze --output=json --file-output=vmd-output.json
fi
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"
- if: runner.os == 'Windows'
name: Create and Run Vue Mess Detector (Windows)
working-directory: ./test-repo
run: |
if ($Env:matrix_package_manager -eq 'pnpm') {
echo "my-package" | pnpm create vue@latest . --default --typescript
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'yarn') {
echo "my-package" | yarn create vue . --default --typescript
touch ./yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'bun') {
echo "my-package" | bun create vue . --default --typescript --ignore-scripts
bun add file:${{ github.workspace }}/package/ --d
bun install --ignore-scripts
bun run vue-mess-detector analyze --output=json --file-output=vmd-output.json
} else {
echo "my-package" | npm create vue@latest -- . --default --typescript
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze --output=json --file-output=vmd-output.json
}
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"
test-nuxi:
runs-on: ${{ matrix.platform }}
needs: build
strategy:
matrix:
platform: [ 'macos-latest', 'ubuntu-latest', 'windows-latest' ]
package-manager: [ npm, yarn, pnpm, bun ]
name: Testing Nuxt with ${{ matrix.package-manager }} on ${{ matrix.platform }}
steps:
- name: Create directories
run: |
mkdir ./package
mkdir ./test-repo
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vue-mess-detector
path: ./package
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- if: matrix.package-manager == 'pnpm'
name: Check PNPM
uses: pnpm/action-setup@v4
with:
version: 'latest'
- if: matrix.package-manager == 'yarn'
name: Check Yarn
run: |
corepack prepare yarn@stable --activate
yarn set version stable
- if: matrix.package-manager == 'bun'
name: Check Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 'latest'
- if: runner.os != 'Windows'
name: Create and Run Vue Mess Detector (Linux/Mac)
working-directory: ./test-repo
run: |
if [ "${{ matrix.package-manager }}" == "pnpm" ]; then
(cd .. && pnpm dlx nuxi@latest init test-repo --package-manager pnpm --git-init -t themes/content-wind)
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "yarn" ]; then
(cd .. && yarn dlx nuxi@latest init test-repo --package-manager yarn --git-init -t themes/content-wind --no-install)
touch yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "bun" ]; then
(cd .. && bun x nuxi@latest init test-repo --package-manager bun --git-init -t themes/content-wind)
bun add file:${{ github.workspace }}/package/ --dev
bun install --ignore-scripts
bun run vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
else
(cd .. && npx nuxi@latest init test-repo --package-manager npm --git-init -t themes/content-wind)
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
fi
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"
- if: runner.os == 'Windows'
name: Create and Run Vue Mess Detector (Windows)
working-directory: ./test-repo
run: |
if ($Env:matrix_package_manager -eq 'pnpm') {
(cd .. && pnpm dlx nuxi@latest init test-repo --package-manager pnpm --git-init -t themes/content-wind)
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'yarn') {
(cd .. && yarn dlx nuxi@latest init test-repo --package-manager yarn --git-init -t themes/content-wind --no-install)
touch ./yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'bun') {
(cd .. && bun x nuxi@latest init test-repo --package-manager bun --git-init -t themes/content-wind)
bun add file:${{ github.workspace }}/package/ --dev
bun install --ignore-scripts
bun run vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
} else {
(cd .. && npx nuxi@latest init test-repo --package-manager npm --git-init -t themes/content-wind)
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
}
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"