From 56ef58cdb2ce997c705db7a11cffa171f6ae6060 Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Tue, 8 Aug 2023 13:45:21 -0700 Subject: [PATCH] test: web build action v2 final v5 --- .github/workflows/main.yml | 74 ++++++++++++++++++++++++++ .github/workflows/pull-request-web.yml | 64 +++++++++++++++++++++- 2 files changed, 136 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c903af6a4..12ce699b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,6 +86,37 @@ jobs: - name: Run Docker Compose run: docker-compose run builder npm run coverage + lint-web: + defaults: + run: + working-directory: web + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Create env file + run: | + touch .env + echo VITE_ACCOUNT=${{ vars.VITE_ACCOUNT }} >> .env + echo VITE_CONNECT=${{ vars.VITE_CONNECT }} >> .env + echo VITE_UNRAID_NET=${{ vars.VITE_UNRAID_NET }} >> .env + echo VITE_CALLBACK_KEY=${{ vars.VITE_CALLBACK_KEY }} >> .env + cat .env + + - name: Install node + uses: actions/setup-node@v3 + with: + cache: "npm" + cache-dependency-path: "web/package-lock.json" + node-version-file: "web/.nvmrc" + + - name: Installing node deps + run: npm install + + - name: Lint files + run: npm run lint + build-api: defaults: run: @@ -144,6 +175,44 @@ jobs: name: unraid-api path: ${{ github.workspace }}/api/deploy/release/*.tgz + build-web: + defaults: + run: + working-directory: web + runs-on: ubuntu-latest + needs: [lint-web] + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Create env file + run: | + touch .env + echo VITE_ACCOUNT=${{ vars.VITE_ACCOUNT }} >> .env + echo VITE_CONNECT=${{ vars.VITE_CONNECT }} >> .env + echo VITE_UNRAID_NET=${{ vars.VITE_UNRAID_NET }} >> .env + echo VITE_CALLBACK_KEY=${{ vars.VITE_CALLBACK_KEY }} >> .env + cat .env + + - name: Install node + uses: actions/setup-node@v3 + with: + cache: "npm" + cache-dependency-path: "web/package-lock.json" + node-version-file: "web/.nvmrc" + + - name: Installing node deps + run: npm install + + - name: Build + run: npm run build + + - name: Upload build to Github artifacts + uses: actions/upload-artifact@v3 + with: + name: unraid-web + path: web/.nuxt/nuxt-custom-elements/dist/unraid-components + build-plugin: needs: [lint-api, test-api, build-api] defaults: @@ -157,6 +226,11 @@ jobs: timezoneLinux: "America/Los_Angeles" - name: Checkout repo uses: actions/checkout@v3 + - name: Download unraid web components + uses: actions/download-artifact@v3 + with: + name: unraid-web + path: ./plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components - name: Build Plugin run: | cd source/dynamix.unraid.net diff --git a/.github/workflows/pull-request-web.yml b/.github/workflows/pull-request-web.yml index 52abf1381..688f8935f 100644 --- a/.github/workflows/pull-request-web.yml +++ b/.github/workflows/pull-request-web.yml @@ -11,10 +11,70 @@ concurrency: jobs: lint-web: + defaults: + run: + working-directory: web runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v3 - - name: Lint, Test, and Build Web Components - uses: ./.github/workflows/lint-test-build-web.yml + - name: Create env file + run: | + touch .env + echo VITE_ACCOUNT=${{ vars.VITE_ACCOUNT }} >> .env + echo VITE_CONNECT=${{ vars.VITE_CONNECT }} >> .env + echo VITE_UNRAID_NET=${{ vars.VITE_UNRAID_NET }} >> .env + echo VITE_CALLBACK_KEY=${{ vars.VITE_CALLBACK_KEY }} >> .env + cat .env + + - name: Install node + uses: actions/setup-node@v3 + with: + cache: "npm" + cache-dependency-path: "web/package-lock.json" + node-version-file: "web/.nvmrc" + + - name: Installing node deps + run: npm install + + - name: Lint files + run: npm run lint + + build-web: + defaults: + run: + working-directory: web + runs-on: ubuntu-latest + needs: [lint-web] + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Create env file + run: | + touch .env + echo VITE_ACCOUNT=${{ vars.VITE_ACCOUNT }} >> .env + echo VITE_CONNECT=${{ vars.VITE_CONNECT }} >> .env + echo VITE_UNRAID_NET=${{ vars.VITE_UNRAID_NET }} >> .env + echo VITE_CALLBACK_KEY=${{ vars.VITE_CALLBACK_KEY }} >> .env + cat .env + + - name: Install node + uses: actions/setup-node@v3 + with: + cache: "npm" + cache-dependency-path: "web/package-lock.json" + node-version-file: "web/.nvmrc" + + - name: Installing node deps + run: npm install + + - name: Build + run: npm run build + + - name: Upload build to Github artifacts + uses: actions/upload-artifact@v3 + with: + name: unraid-web + path: web/.nuxt/nuxt-custom-elements/dist/unraid-components