diff --git a/.github/workflows/next-13.yml b/.github/workflows/next-13.yml index 4eab2dede..9921a76fc 100644 --- a/.github/workflows/next-13.yml +++ b/.github/workflows/next-13.yml @@ -90,15 +90,15 @@ jobs: notify: needs: test-next-13 - if: failure() + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' 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 + text: 'Next.js 13 Test: ${{ job.status }}' + fields: repo,commit,action,eventName env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/next-14.yml b/.github/workflows/next-14.yml index 748217d8b..8701547a0 100644 --- a/.github/workflows/next-14.yml +++ b/.github/workflows/next-14.yml @@ -90,15 +90,15 @@ jobs: notify: needs: test-next-14 - if: failure() + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' 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 + text: 'Next.js 14 Test: ${{ job.status }}' + fields: repo,commit,action,eventName env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/next-latest.yml b/.github/workflows/next-latest.yml index 5f2a7abc2..25b09a4a1 100644 --- a/.github/workflows/next-latest.yml +++ b/.github/workflows/next-latest.yml @@ -110,15 +110,15 @@ jobs: notify: needs: test-next-latest - if: failure() + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' 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 + text: 'Next.js Latest Test: ${{ job.status }}' + fields: repo,commit,action,eventName env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/nextjs-test.yml b/.github/workflows/nextjs-test.yml deleted file mode 100644 index 9d85ac2aa..000000000 --- a/.github/workflows/nextjs-test.yml +++ /dev/null @@ -1,297 +0,0 @@ -name: Next.js 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.mjs next.config.original.mjs - - name: Create new next.config file - working-directory: test-app - run: | - cat < 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 < src/app/page.tsx - import { - Button, - ButtonText, - ButtonSpinner, - ButtonIcon, - ButtonGroup, - } from "@/components/ui/button" - - export default function Home() { - return ( -
- -
- ) - } - 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 - - 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 < 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 < src/app/page.tsx - import { - Button, - ButtonText, - ButtonSpinner, - ButtonIcon, - ButtonGroup, - } from "@/components/ui/button" - - export default function Home() { - return ( -
- -
- ) - } - 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 - - 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 < 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 < src/app/page.tsx - import { - Button, - ButtonText, - ButtonSpinner, - ButtonIcon, - ButtonGroup, - } from "@/components/ui/button" - - export default function Home() { - return ( -
- -
- ) - } - 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, test-next-14, 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 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, test-next-14, test-next-13] - 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 github-actions@github.com - git add .next-version - git commit -m "Update Next.js version to ${{ needs.check-next-version.outputs.latest_version }}" - git push