Test turbopack support regression #38
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Lint library | |
run: yarn lint | |
- name: Test library | |
run: yarn test | |
- name: Build library | |
run: yarn build | |
- name: Create package | |
run: yarn pack | |
- name: Lint package | |
run: yarn lint:package | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package.tgz | |
path: decs-typeschema-*.tgz | |
bundle_with_vite: | |
needs: build | |
name: Test bundling with Vite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Create a Vite project | |
run: yarn create vite sample --template vanilla-ts | |
- name: Download package | |
uses: actions/download-artifact@v3 | |
with: | |
name: package.tgz | |
- name: Add package | |
working-directory: ./sample | |
run: yarn add $(ls ../decs-typeschema-*.tgz) zod | |
- name: Use package | |
working-directory: ./sample | |
run: | | |
echo " | |
import {validate} from '@decs/typeschema'; | |
import {z} from 'zod'; | |
validate(z.string(), 'hello').then(console.log); | |
" > src/main.ts | |
- name: Bundle project | |
working-directory: ./sample | |
run: yarn build | |
bundle_with_webpack: | |
needs: build | |
name: Test bundling with Webpack | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Create a Next.js project | |
run: yarn create next-app sample --ts --eslint --tailwind --src-dir --app --import-alias="@/*" | |
- name: Download package | |
uses: actions/download-artifact@v3 | |
with: | |
name: package.tgz | |
- name: Add package | |
working-directory: ./sample | |
run: yarn add $(ls ../decs-typeschema-*.tgz) zod | |
- name: Use package | |
working-directory: ./sample | |
run: | | |
echo " | |
import {validate} from '@decs/typeschema'; | |
import {z} from 'zod'; | |
export default function Page() { | |
validate(z.string(), 'hello').then(console.log); | |
} | |
" > src/app/page.tsx | |
- name: Bundle project | |
working-directory: ./sample | |
run: yarn build | |
bundle_with_turbopack: | |
needs: build | |
name: Test bundling with Turbopack | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Create a Next.js project | |
run: yarn create next-app sample --ts --eslint --tailwind --src-dir --app --import-alias="@/*" | |
- name: Download package | |
uses: actions/download-artifact@v3 | |
with: | |
name: package.tgz | |
- name: Add package | |
working-directory: ./sample | |
run: yarn add $(ls ../decs-typeschema-*.tgz) zod | |
- name: Use package | |
working-directory: ./sample | |
run: | | |
echo " | |
import {validate} from '@decs/typeschema'; | |
import {z} from 'zod'; | |
export default function Page() { | |
validate(z.string(), 'hello').then(console.log); | |
} | |
" > src/app/page.tsx | |
- name: Start development server | |
working-directory: ./sample | |
run: yarn next dev --turbo & | |
- name: Load page | |
working-directory: ./sample | |
run: curl http://127.0.0.1:3000 -f | |
check_for_version_upgrade: | |
name: Check for version upgrade | |
if: | | |
github.event_name == 'push' || | |
github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login | |
runs-on: ubuntu-latest | |
needs: [bundle_with_vite, bundle_with_webpack, bundle_with_turbopack] | |
outputs: | |
from_version: ${{steps.check.outputs.from_version}} | |
to_version: ${{steps.check.outputs.to_version}} | |
is_upgraded_version: ${{steps.check.outputs.is_upgraded_version}} | |
is_pre_release: ${{steps.check.outputs.is_pre_release}} | |
steps: | |
- uses: garronej/ts-ci@v2.1.0 | |
id: check | |
with: | |
action_name: is_package_json_version_upgraded | |
branch: ${{github.head_ref || github.ref}} | |
publish_to_deno: | |
name: Publish to Deno | |
runs-on: ubuntu-latest | |
needs: check_for_version_upgrade | |
if: | | |
needs.check_for_version_upgrade.outputs.is_upgraded_version == 'true' && | |
( | |
github.event_name == 'push' || | |
needs.check_for_version_upgrade.outputs.is_pre_release == 'true' | |
) | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Skip GitHub actions | |
run: rm -r .github | |
- name: Remove deno-dist branch if it exists | |
run: git push origin :deno-dist || true | |
- name: Checkout deno-dist branch | |
run: git checkout -b deno-dist | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build library | |
run: yarn build:deno | |
- name: Track deno_dist folder | |
run: npx -y -p denoify remove_deno_dist_from_gitignore | |
env: | |
DRY_RUN: '0' | |
- name: Push changes | |
run: | | |
git config --global user.name actions | |
git config --global user.email actions@github.com | |
git add -A | |
git commit -am "Add deno distribution files" | |
git push origin deno-dist | |
- name: Create release on GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: v${{needs.check_for_version_upgrade.outputs.to_version}} | |
tag_name: v${{needs.check_for_version_upgrade.outputs.to_version}} | |
target_commitish: deno-dist | |
generate_release_notes: false | |
draft: false | |
prerelease: ${{needs.check_for_version_upgrade.outputs.is_pre_release == 'true'}} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Remove deno-dist branch | |
run: git push origin :deno-dist | |
publish_to_npm: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
needs: check_for_version_upgrade | |
if: | | |
needs.check_for_version_upgrade.outputs.is_upgraded_version == 'true' && | |
( | |
github.event_name == 'push' || | |
needs.check_for_version_upgrade.outputs.is_pre_release == 'true' | |
) | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build library | |
run: yarn build | |
- name: Publish library to NPM | |
uses: JS-DevTools/npm-publish@v2 | |
with: | |
token: ${{secrets.NPM_TOKEN}} |