Skip to content

Commit

Permalink
Added Expo Web as well
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketsahu committed Oct 25, 2024
1 parent f5a587e commit b6c97e1
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 5 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/expo-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Expo Latest

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

jobs:
check-expo-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 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: ubuntu-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
- name: Install gluestack-ui
working-directory: test-app
run: |
npx gluestack-ui init --template-only --projectType expo
npx gluestack-ui add --all
- name: Add Button component
working-directory: test-app
run: |
cat <<EOT > 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 (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Button size="md" variant="solid" action="primary">
<ButtonText>Hello World!</ButtonText>
</Button>
</View>
);
}
EOT
- name: Start Expo web app
working-directory: test-app
run: |
npm run web & sleep 30
- name: Check if button is rendered
run: |
if curl -s http://localhost:8081 | 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-expo-latest
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: 'Expo Latest Test: ${{ job.status }}'
fields: repo,commit,action,eventName
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

update-version:
needs: test-expo-latest
if: ${{ needs.check-expo-version.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Expo version file
run: |
echo ${{ needs.check-expo-version.outputs.latest_version }} > .expo-version
git config user.name github-actions
git config user.email [email protected]
git add .expo-version
git commit -m "Update Expo version to ${{ needs.check-expo-version.outputs.latest_version }}"
git push
2 changes: 1 addition & 1 deletion .github/workflows/next-13.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Next.js 13 gluestack-ui Test
name: Next.js 13.x

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/next-14.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Next.js 14 gluestack-ui Test
name: Next.js 14.x

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/next-latest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Next.js Latest gluestack-ui Test
name: Next.js Latest

on:
push:
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# gluestack-ui v2

[![Next.js Latest](https://github.com/gluestack/gluestack-ui/actions/workflows/next-latest.yml/badge.svg)](https://github.com/gluestack/gluestack-ui/actions/workflows/next-latest.yml)
[![Next.js 14](https://github.com/gluestack/gluestack-ui/actions/workflows/next-14.yml/badge.svg)](https://github.com/gluestack/gluestack-ui/actions/workflows/next-14.yml)
[![Next.js 13](https://github.com/gluestack/gluestack-ui/actions/workflows/next-13.yml/badge.svg)](https://github.com/gluestack/gluestack-ui/actions/workflows/next-13.yml)
[![Next.js 14.x](https://github.com/gluestack/gluestack-ui/actions/workflows/next-14.yml/badge.svg)](https://github.com/gluestack/gluestack-ui/actions/workflows/next-14.yml)
[![Next.js 13.x](https://github.com/gluestack/gluestack-ui/actions/workflows/next-13.yml/badge.svg)](https://github.com/gluestack/gluestack-ui/actions/workflows/next-13.yml)
[![Expo Latest](https://github.com/gluestack/gluestack-ui/actions/workflows/expo-latest.yml/badge.svg)](https://github.com/gluestack/gluestack-ui/actions/workflows/expo-latest.yml)
[![Expo 51.x](https://github.com/gluestack/gluestack-ui/actions/workflows/expo-51.yml/badge.svg)](https://github.com/gluestack/gluestack-ui/actions/workflows/expo-51.yml)

<h3 align="center">
<a href="https://github.com/gluestack/gluestack-ui">
Expand Down

0 comments on commit b6c97e1

Please sign in to comment.