Skip to content

Commit

Permalink
Added the files
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketsahu committed Oct 25, 2024
1 parent 1ae2405 commit 27fb0f3
Show file tree
Hide file tree
Showing 3 changed files with 347 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/next-13.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Next.js 13 gluestack-ui Test

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC

jobs:
test-next-13:
runs-on: ubuntu-latest
name: Next.js 13
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Create Next.js project
run: |
npx create-next-app@13 test-app --typescript --eslint --tailwind --app --src-dir --use-npm --no-experimental-app
cd test-app
- name: Install gluestack-ui
working-directory: test-app
run: |
npx gluestack-ui init --template-only --projectType nextjs
npx gluestack-ui add --all
- name: Rename original next.config file
working-directory: test-app
run: mv next.config.js next.config.original.js
- name: Create new next.config file
working-directory: test-app
run: |
cat <<EOT > next.config.js
const originalConfig = require('./next.config.original.js');
/** @type {import('next').NextConfig} */
const nextConfig = {
...originalConfig,
typescript: {
ignoreBuildErrors: true,
},
};
module.exports = nextConfig;
EOT
- name: Add Button component
working-directory: test-app
run: |
cat <<EOT > src/app/page.tsx
import {
Button,
ButtonText,
ButtonSpinner,
ButtonIcon,
ButtonGroup,
} from "@/components/ui/button"
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<Button size="md" variant="solid" action="primary">
<ButtonText>Hello World!</ButtonText>
</Button>
</main>
)
}
EOT
- name: Build Next.js app
working-directory: test-app
env:
NEXT_TELEMETRY_DISABLED: 1
run: |
echo "{ \"extends\": \"next/core-web-vitals\", \"rules\": {} }" > .eslintrc.json
npm run build -- --no-lint
- name: Start Next.js app
working-directory: test-app
run: npm run start & sleep 10
- name: Check if button is rendered
run: |
if curl -s http://localhost:3000 | grep -q "Hello World!"; then
echo "Button found on the page"
exit 0
else
echo "Button not found on the page"
exit 1
fi
notify:
needs: test-next-13
if: failure()
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: 'Next.js 13 gluestack-ui Test failed!'
fields: repo,message,commit,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
104 changes: 104 additions & 0 deletions .github/workflows/next-14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Next.js 14 gluestack-ui Test

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC

jobs:
test-next-14:
runs-on: ubuntu-latest
name: Next.js 14
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Create Next.js project
run: |
npx create-next-app@14 test-app --typescript --eslint --tailwind --app --src-dir --use-npm --no-experimental-app
cd test-app
- name: Install gluestack-ui
working-directory: test-app
run: |
npx gluestack-ui init --template-only --projectType nextjs
npx gluestack-ui add --all
- name: Rename original next.config file
working-directory: test-app
run: mv next.config.mjs next.config.original.mjs
- name: Create new next.config file
working-directory: test-app
run: |
cat <<EOT > next.config.mjs
import originalConfig from './next.config.original.mjs';
/** @type {import('next').NextConfig} */
const nextConfig = {
...originalConfig,
typescript: {
ignoreBuildErrors: true,
},
};
export default nextConfig;
EOT
- name: Add Button component
working-directory: test-app
run: |
cat <<EOT > src/app/page.tsx
import {
Button,
ButtonText,
ButtonSpinner,
ButtonIcon,
ButtonGroup,
} from "@/components/ui/button"
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<Button size="md" variant="solid" action="primary">
<ButtonText>Hello World!</ButtonText>
</Button>
</main>
)
}
EOT
- name: Build Next.js app
working-directory: test-app
env:
NEXT_TELEMETRY_DISABLED: 1
run: |
echo "{ \"extends\": \"next/core-web-vitals\", \"rules\": {} }" > .eslintrc.json
npm run build -- --no-lint
- name: Start Next.js app
working-directory: test-app
run: npm run start & sleep 10
- name: Check if button is rendered
run: |
if curl -s http://localhost:3000 | grep -q "Hello World!"; then
echo "Button found on the page"
exit 0
else
echo "Button not found on the page"
exit 1
fi
notify:
needs: test-next-14
if: failure()
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: 'Next.js 14 gluestack-ui Test failed!'
fields: repo,message,commit,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
139 changes: 139 additions & 0 deletions .github/workflows/next-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Next.js Latest gluestack-ui Test

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC

jobs:
check-next-version:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
latest_version: ${{ steps.check.outputs.latest_version }}
steps:
- id: check
run: |
LATEST=$(npm view next version)
CURRENT=$(cat .next-version 2>/dev/null || echo "")
if [ "$LATEST" != "$CURRENT" ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
echo "latest_version=$LATEST" >> $GITHUB_OUTPUT
echo $LATEST > .next-version
else
echo "should_run=false" >> $GITHUB_OUTPUT
fi
test-next-latest:
needs: check-next-version
if: ${{ needs.check-next-version.outputs.should_run == 'true' || github.event_name == 'push' || github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
name: Next.js latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Create Next.js project
run: |
npx create-next-app@latest test-app --typescript --eslint --tailwind --app --src-dir --use-npm --no-experimental-app
cd test-app
- name: Install gluestack-ui
working-directory: test-app
run: |
npx gluestack-ui init --template-only --projectType nextjs
npx gluestack-ui add --all
- name: Rename original next.config file
working-directory: test-app
run: mv next.config.ts next.config.original.ts
- name: Create new next.config file
working-directory: test-app
run: |
cat <<EOT > next.config.ts
import originalConfig from './next.config.original.ts';
/** @type {import('next').NextConfig} */
const nextConfig = {
...originalConfig,
typescript: {
ignoreBuildErrors: true,
},
};
export default nextConfig;
EOT
- name: Add Button component
working-directory: test-app
run: |
cat <<EOT > src/app/page.tsx
import {
Button,
ButtonText,
ButtonSpinner,
ButtonIcon,
ButtonGroup,
} from "@/components/ui/button"
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<Button size="md" variant="solid" action="primary">
<ButtonText>Hello World!</ButtonText>
</Button>
</main>
)
}
EOT
- name: Build Next.js app
working-directory: test-app
env:
NEXT_TELEMETRY_DISABLED: 1
run: |
echo "{ \"extends\": \"next/core-web-vitals\", \"rules\": {} }" > .eslintrc.json
npm run build -- --no-lint
- name: Start Next.js app
working-directory: test-app
run: npm run start & sleep 10
- name: Check if button is rendered
run: |
if curl -s http://localhost:3000 | grep -q "Hello World!"; then
echo "Button found on the page"
exit 0
else
echo "Button not found on the page"
exit 1
fi
notify:
needs: test-next-latest
if: failure()
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: 'Next.js Latest gluestack-ui Test failed!'
fields: repo,message,commit,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

update-version:
needs: test-next-latest
if: ${{ needs.check-next-version.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Next.js version file
run: |
echo ${{ needs.check-next-version.outputs.latest_version }} > .next-version
git config user.name github-actions
git config user.email [email protected]
git add .next-version
git commit -m "Update Next.js version to ${{ needs.check-next-version.outputs.latest_version }}"
git push

0 comments on commit 27fb0f3

Please sign in to comment.