From 60797f07d463286409543b001b051051ea1d72d1 Mon Sep 17 00:00:00 2001 From: Dmytro Svyrydenko Date: Thu, 9 Nov 2023 17:54:33 +0200 Subject: [PATCH] feat: Add CI to verify all entries can be built --- .github/actions/prepare-local-env/action.yml | 32 +++++++++++ .github/workflows/build-entries.yml | 57 ++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/actions/prepare-local-env/action.yml create mode 100644 .github/workflows/build-entries.yml diff --git a/.github/actions/prepare-local-env/action.yml b/.github/actions/prepare-local-env/action.yml new file mode 100644 index 0000000..5060ed8 --- /dev/null +++ b/.github/actions/prepare-local-env/action.yml @@ -0,0 +1,32 @@ +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@v4 + with: + node-version: "${{ steps.nvm.outputs.NVMRC }}" + cache: npm + # - 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- diff --git a/.github/workflows/build-entries.yml b/.github/workflows/build-entries.yml new file mode 100644 index 0000000..4277198 --- /dev/null +++ b/.github/workflows/build-entries.yml @@ -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