-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from brenoepics/ci-1
ci: add workflows for running vue + nuxt integration tests
- Loading branch information
Showing
8 changed files
with
309 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This workflow checks that the `dist/` directory is up-to-date with the source | ||
name: Check Transpiled JavaScript | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
check-dist: | ||
name: Check dist/ | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set node version | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'yarn' | ||
|
||
- name: Build dist/ Directory | ||
id: build | ||
run: | | ||
yarn install | ||
yarn build | ||
# This will fail the workflow if the `dist/` directory is different from | ||
# expected. | ||
- name: Compare Directories | ||
id: diff | ||
run: | | ||
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. See status below:" | ||
git diff --ignore-space-at-eol --text dist/ | ||
exit 1 | ||
fi |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
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'); }" |
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
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
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
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