From 1c67f9cdccfdc0e39a3f3d7bb168bb44ff5881e2 Mon Sep 17 00:00:00 2001 From: Sanchitv3 Date: Thu, 26 Jun 2025 17:50:18 +0530 Subject: [PATCH] feat: added workflows for nightly package --- .github/workflows/expo-latest-nightly.yml | 105 ++++++++++++++ .github/workflows/next-latest-nightly.yml | 98 +++++++++++++ .github/workflows/vercel-deployments.yml | 164 ++++++++++++++++++++++ 3 files changed, 367 insertions(+) create mode 100644 .github/workflows/expo-latest-nightly.yml create mode 100644 .github/workflows/next-latest-nightly.yml create mode 100644 .github/workflows/vercel-deployments.yml diff --git a/.github/workflows/expo-latest-nightly.yml b/.github/workflows/expo-latest-nightly.yml new file mode 100644 index 0000000000..677529f4c3 --- /dev/null +++ b/.github/workflows/expo-latest-nightly.yml @@ -0,0 +1,105 @@ +name: Expo Latest + +on: + push: + branches: [ feat/v3 ] + pull_request: + branches: [ feat/v3 ] + schedule: + - cron: '0 0 * * *' # Run daily at midnight UTC + +jobs: + check-expo-version: + runs-on: macos-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + latest_version: ${{ steps.check.outputs.latest_version }} + steps: + - id: check + run: | + LATEST=$(npm view expo version) + CURRENT=$(cat .expo-version 2>/dev/null || echo "") + if [ "$LATEST" != "$CURRENT" ]; then + echo "should_run=true" >> $GITHUB_OUTPUT + echo "latest_version=$LATEST" >> $GITHUB_OUTPUT + echo $LATEST > .expo-version + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + test-expo-latest: + needs: check-expo-version + if: ${{ needs.check-expo-version.outputs.should_run == 'true' || github.event_name == 'push' || github.event_name == 'pull_request' }} + runs-on: macos-latest + name: Expo latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Create Expo project + run: | + npx create-expo-app@latest test-app + cd test-app + - name: Install dependencies + working-directory: test-app + run: | + npm install react-native-web react-dom @expo/metro-runtime + - name: Install gluestack-ui + working-directory: test-app + run: | + npx gluestack-ui-nightly init --template-only --projectType expo + npx gluestack-ui-nightly add --all + npx tailwindcss -i ./global.css -o ./node_modules/.cache/nativewind/global.css + - name: Add Button component + working-directory: test-app + run: | + mkdir -p app/\(tabs\) + cat < app/\(tabs\)/index.tsx + import React from 'react'; + import { View } from 'react-native'; + import { Button, ButtonText } from '@/components/ui/button'; + export default function App() { + return ( + + + + ); + } + EOT + - name: Start Expo web app + working-directory: test-app + run: | + npm run web & sleep 30 + - name: Check if button is rendered + run: | + echo "First curl attempt:" + curl -s http://localhost:8081 | tee curl_output_1.log + echo "Waiting for 30 seconds..." + sleep 30 + echo "Second curl attempt:" + curl -s http://localhost:8081 | tee curl_output_2.log + echo "Searching for 'Hello World!' in the output:" + if grep -q "Hello World!" curl_output_1.log || grep -q "Hello World!" curl_output_2.log; then + echo "Button found on the page" + exit 0 + else + echo "Button not found on the page" + exit 1 + fi + notify: + needs: test-expo-latest + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + runs-on: macos-latest + steps: + - name: Slack Notification + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + text: 'Expo Latest Test: ${{ job.status }}' + fields: repo,commit,action,eventName + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/next-latest-nightly.yml b/.github/workflows/next-latest-nightly.yml new file mode 100644 index 0000000000..d6321011c0 --- /dev/null +++ b/.github/workflows/next-latest-nightly.yml @@ -0,0 +1,98 @@ +name: Next.js Latest + +on: + push: + branches: [feat/v3] + pull_request: + branches: [feat/v3] + 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 "") + echo "Latest version: $LATEST" + echo "Current version: $CURRENT" + 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: Print Environment Info + run: | + node -v + npm -v + cat .next-version || echo ".next-version file not found" + + - name: Set Git identity + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create Next.js project from create-command + run: | + npx create-gluestack-nightly@latest test-app --next-app-router + cd test-app + + - name: Build Next.js app + working-directory: test-app + env: + NEXT_TELEMETRY_DISABLED: 1 + run: | + npm run build + + - name: Start Next.js app + working-directory: test-app + run: | + npm run start & + sleep 20 + + - name: Fetch and Log Server Response + run: | + curl -s http://localhost:3000 || echo "Failed to reach the server" + curl -s http://localhost:3000 > server_response.html + cat server_response.html + + - name: Check if text is rendered + run: | + RESPONSE=$(curl -s http://localhost:3000) + echo "$RESPONSE" | grep -q "Get started by editing" && echo "text found" || (echo "text not found" && exit 1) + + notify: + needs: test-next-latest + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + runs-on: ubuntu-latest + steps: + - name: Slack Notification + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/vercel-deployments.yml b/.github/workflows/vercel-deployments.yml new file mode 100644 index 0000000000..e838e969a7 --- /dev/null +++ b/.github/workflows/vercel-deployments.yml @@ -0,0 +1,164 @@ +name: Vercel Deployments + +on: + push: + branches: [feat/v3] + pull_request: + branches: [feat/v3] + +jobs: + deploy-kitchen-sink: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install Vercel CLI + run: npm install -g vercel@latest + + - name: Install dependencies + run: npm install + + - name: Deploy to Vercel (Production) + if: github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + working-directory: ./apps/kitchen-sink + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --prod --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name kitchen-sink + + - name: Deploy to Vercel (Preview) + if: github.event_name == 'pull_request' + working-directory: ./apps/kitchen-sink + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name kitchen-sink + + deploy-todo-app: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install Vercel CLI + run: npm install -g vercel@latest + + - name: Install dependencies + run: npm install + + - name: Deploy to Vercel (Production) + if: github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + working-directory: ./apps/todo-app + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --prod --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name todo-app + + - name: Deploy to Vercel (Preview) + if: github.event_name == 'pull_request' + working-directory: ./apps/todo-app + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name todo-app + + deploy-starter-kit-expo: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install Vercel CLI + run: npm install -g vercel@latest + + - name: Install dependencies + run: npm install + + - name: Deploy to Vercel (Production) + if: github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + working-directory: ./apps/starter-kit-expo + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --prod --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name starter-kit-expo + + - name: Deploy to Vercel (Preview) + if: github.event_name == 'pull_request' + working-directory: ./apps/starter-kit-expo + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name starter-kit-expo + + deploy-starter-kit-next: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install Vercel CLI + run: npm install -g vercel@latest + + - name: Install dependencies + run: npm install + + - name: Deploy to Vercel (Production) + if: github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + working-directory: ./apps/starter-kit-next + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --prod --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name starter-kit-next + + - name: Deploy to Vercel (Preview) + if: github.event_name == 'pull_request' + working-directory: ./apps/starter-kit-next + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + run: | + vercel --yes --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID \ + --build-env NODE_OPTIONS="--max-old-space-size=4096" \ + --name starter-kit-next