Skip to content

Commit

Permalink
Merge branch 'Deployment/CI-CD' of https://github.com/NavMapLabs/Navi…
Browse files Browse the repository at this point in the history
…gationApp into Main-Canvas_HL
  • Loading branch information
Honghui-Li-8 committed Aug 19, 2024
2 parents d33f769 + 461aa76 commit 8e0c04f
Show file tree
Hide file tree
Showing 21 changed files with 26,882 additions and 10,790 deletions.
40 changes: 40 additions & 0 deletions .github/actions/setup-and-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Setup and Install Dependencies
description: Set up Node.js and install npm dependencies

runs:
using: "composite"
steps:
- name: Set-Up Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ inputs.node-version }}

# Use Cache to speed up process
- name: Restore npm package from cache
uses: actions/cache@v4
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install package
# some package reported not-found after cache restore
# better always run npm install to solve those
# if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
run: npm install

# Update Cache on the miss (fall back)
- name: Update npm cache on cache-miss
if: steps.npm-cache.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

inputs:
node-version:
description: 'Node.js version'
required: true
74 changes: 74 additions & 0 deletions .github/workflows/Node-js-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

name: Node.js CI

on:
push:
branches: [ Deployment/CI-CD ]
pull_request:
branches: [ Deployment/CI-CD ]

# Grant the necessary permission to workflow
permissions:
contents: read
pages: write
id-token: write

jobs:
# Test workflow
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Check out Branch
uses: actions/checkout@v2

# use self-define steps to load env
- name: Load Node.js
uses: ./.github/actions/setup-and-install
with:
node-version: ${{ matrix.node-version }}

- name: Running Test
run: npm run test

# Build workflow
build:
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Check out Branch
uses: actions/checkout@v2

# use self-define steps to load env
- name: Load Node.js
uses: ./.github/actions/setup-and-install
with:
node-version: ${{ matrix.node-version }}

- name: Setup Github Pages
uses: actions/configure-pages@v5

- name: Build Expo project
run: npx expo export -p web

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist

# Deployment workflow
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to github page
id: deployment
uses: actions/deploy-pages@v4
118 changes: 60 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,60 @@
# Welcome to your Expo app 👋

This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).

## Get started

1. Install dependencies

```bash
npm install
```

2. Start the app

```bash
npx expo start
```

In the output, you'll find options to open the app in a

- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo

You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).

## Get a fresh project

When you're ready, run:

```bash
npm run reset-project
```

This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.

## Learn more

To learn more about developing your project with Expo, look at the following resources:

- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.

## Join the community

Join our community of developers creating universal apps.

- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.


To run your project, navigate to the directory and run one of the following npm commands.

- cd NavigationApp
- npm run android
- npm run ios # you need to use macOS to build the iOS project - use the Expo app if you need to do iOS development without a Mac
- npm run web
# Welcome to your Expo app 👋

This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).

## Get started

1. Install dependencies

```bash
npm install
```

2. Start the app

```bash
npx expo start
```

In the output, you'll find options to open the app in a

- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo

You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).

## Get a fresh project

When you're ready, run:

```bash
npm run reset-project
```

This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.

## Learn more

To learn more about developing your project with Expo, look at the following resources:

- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.

## Join the community

Join our community of developers creating universal apps.

- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.


To run your project, navigate to the directory and run one of the following npm commands.

- cd NavigationApp
- npm run android
- npm run ios # you need to use macOS to build the iOS project - use the Expo app if you need to do iOS development without a Mac
- npm run web

SUS
13 changes: 13 additions & 0 deletions __tests__/index-test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { render } from '@testing-library/react-native';

import Index from '@/app/index';

describe('\"Go to Login\ option"', () => {
test('\"Go to Login\ option renders correctly on Index', () => {
const { getByText } = render(<Index />);

const textLabel = getByText('Go to Login');

expect(textLabel).toBeTruthy();
});
});
8 changes: 4 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
}
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
"output": "single",
"bundler": "metro"
},
"plugins": [
"expo-router"
],
"experiments": {
"typedRoutes": true
"typedRoutes": true,
"baseUrl": "/NavigationApp"
}
}
}
10 changes: 10 additions & 0 deletions coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1724046037870" clover="3.2.0">
<project timestamp="1724046037870" name="All files">
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1" elements="2" coveredelements="2" complexity="0" loc="1" ncloc="1" packages="1" files="1" classes="1"/>
<file name="index.tsx" path="X:\Desktop\NavigationApp\app\index.tsx">
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1"/>
<line num="5" count="1" type="stmt"/>
</file>
</project>
</coverage>
2 changes: 2 additions & 0 deletions coverage/coverage-final.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"X:\\Desktop\\NavigationApp\\app\\index.tsx": {"path":"X:\\Desktop\\NavigationApp\\app\\index.tsx","statementMap":{"0":{"start":{"line":5,"column":2},"end":{"line":18,"column":4}}},"fnMap":{"0":{"name":"Index","decl":{"start":{"line":4,"column":24},"end":{"line":4,"column":29}},"loc":{"start":{"line":4,"column":32},"end":{"line":19,"column":1}},"line":4}},"branchMap":{},"s":{"0":1},"f":{"0":1},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"182c20a15a8eb2e940e5d01852958c9e78321131"}
}
Loading

0 comments on commit 8e0c04f

Please sign in to comment.