Skip to content

Commit

Permalink
feat: Add CI to verify all entries can be built
Browse files Browse the repository at this point in the history
  • Loading branch information
letehaha committed Nov 9, 2023
1 parent 7621240 commit 2dd3d55
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/actions/prepare-local-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Prepare local env
description: Prepare local environment by setup node, and cache dependencies
outputs:
cache-hit:
description: Whether the dependencies were cached
value: ${{ steps.npm-cache.outputs.cache-hit }}
runs:
using: composite
steps:
- name: Read .nvmrc
shell: bash
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: Get npm cache directory
shell: bash
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v3
id: npm-cache
with:
path: |
**/node_modules
${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
57 changes: 57 additions & 0 deletions .github/workflows/build-entries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build xNFT, web, and mobile

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
prepare-dependencies:
name: Prepare local deps
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- id: prepare-env
uses: ./.github/actions/prepare-local-env
- name: Use cache or install dependencies
if: steps.prepare-env.outputs.cache-hit != 'true'
run: npm ci

build-xnft:
name: Build xNFT
needs: prepare-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: ./.github/actions/prepare-local-env
- name: Build xNFT
run: npm run build:xnft

build-web:
name: Build web
needs: prepare-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: ./.github/actions/prepare-local-env
- name: Build web
run: npm run build:web

# build-android:
# name: Build Android
# needs: prepare-dependencies
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# - uses: ./.github/actions/prepare-local-env
# - name: 🏗 Setup EAS
# uses: expo/expo-github-action@v8
# with:
# eas-version: latest
# - name: Build Android
# run: npm run build:mobile:prod

0 comments on commit 2dd3d55

Please sign in to comment.