From 8572ecf3027548a39445fbe5bb90c04f53323526 Mon Sep 17 00:00:00 2001 From: J Blackman Date: Sat, 16 Sep 2023 03:46:00 +1000 Subject: [PATCH] Adding workflow items for Web App build (#3579) --- .github/workflows/app-build.yml | 74 +++++++++++++++++++++++++++++++ .github/workflows/app-nightly.yml | 12 +++++ .github/workflows/app-weekly.yml | 12 +++++ .github/workflows/ci.yml | 4 +- 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/app-build.yml create mode 100644 .github/workflows/app-nightly.yml create mode 100644 .github/workflows/app-weekly.yml diff --git a/.github/workflows/app-build.yml b/.github/workflows/app-build.yml new file mode 100644 index 0000000000..6988c540cf --- /dev/null +++ b/.github/workflows/app-build.yml @@ -0,0 +1,74 @@ +# Builds Betaflight Configurator for Web Deployment. + +name: App Build (Web) + +on: + workflow_call: + inputs: + path: + description: 'Specifies the path to use in the output of the build' + required: false + type: string + +jobs: + test: + name: Test + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Cache node_modules + uses: actions/cache@v3 + with: + path: node_modules/ + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + + - run: yarn install --immutable --immutable-cache --check-cache + + - name: Run unit tests + run: yarn test + + build: + name: Build (Web App) + needs: test + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Cache Vite + uses: actions/cache@v3 + with: + path: cache/ + key: vite-${{ inputs.path }}-${{ hashFiles('vite.config.js') }} + + - name: Cache node_modules + uses: actions/cache@v3 + with: + path: node_modules/ + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + + - run: yarn install --immutable --immutable-cache --check-cache + + - run: yarn build + + - name: Push to AWS + uses: jakejarvis/s3-sync-action@master + with: + args: --delete + env: + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + SOURCE_DIR: 'dist' + DEST_DIR: ${{ inputs.path }} diff --git a/.github/workflows/app-nightly.yml b/.github/workflows/app-nightly.yml new file mode 100644 index 0000000000..73d2b6e652 --- /dev/null +++ b/.github/workflows/app-nightly.yml @@ -0,0 +1,12 @@ +name: App Nightly Release + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + ci: + name: App Build + uses: ./.github/workflows/app-build.yml + with: + path: 'nightly' diff --git a/.github/workflows/app-weekly.yml b/.github/workflows/app-weekly.yml new file mode 100644 index 0000000000..4f0c5452d9 --- /dev/null +++ b/.github/workflows/app-weekly.yml @@ -0,0 +1,12 @@ +name: App Weekly Release + +on: + schedule: + - cron: '0 1 * * 0' + +jobs: + ci: + name: App Build + uses: ./.github/workflows/app-build.yml + with: + path: 'weekly' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faa54aed17..cd233d0213 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,10 @@ # Builds Betaflight Configurator on Windows, Android, Linux and macOS platforms. # -# After building, artifacts are released to a seperate repository. +# After building, artifacts are released to a separate repository. name: CI -on: +on: workflow_call: inputs: debug_build: