From 9ef3f5f3077bcffd6ea970c688d344fa03965c5d Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Tue, 13 Jun 2023 23:12:22 +0200 Subject: [PATCH] Fix nightly/release + integration workflow (#8450) * Revert "Add e2e tests with playwright (#8123)" This reverts commit 0df815729b5471bc7c448857d60137684b926611. * Revert "Revert "Add e2e tests with playwright (#8123)"" This reverts commit 2299306954045dfe62541d5520a66b5ab7ec4971. * fix nightly/release * fix nightly/release * fix nightly/release --------- Co-authored-by: andig --- .github/workflows/default.yml | 82 ++++++++++++++++--- .gitignore | 4 + .../components/Energyflow/Visualization.vue | 6 +- assets/js/components/Loadpoints.vue | 1 + package-lock.json | 30 +++++++ package.json | 4 +- playwright.config.js | 32 ++++++++ tests/basics.evcc.yaml | 34 ++++++++ tests/basics.spec.js | 40 +++++++++ tests/utils.js | 7 ++ 10 files changed, 227 insertions(+), 13 deletions(-) create mode 100644 playwright.config.js create mode 100755 tests/basics.evcc.yaml create mode 100644 tests/basics.spec.js create mode 100644 tests/utils.js diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 5b6c099d8..ff6ecdd79 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -44,15 +44,38 @@ jobs: steps: - uses: actions/checkout@v3 - # - uses: actions/setup-go@v4 - uses: erezrokah/setup-go@feat/add_cache_prefix with: go-version: ^1.20 cache-key-prefix: build-cache- id: go + - uses: actions/setup-node@v3 + with: + node-version: "18" + cache: "npm" + + - name: Install UI + run: make install-ui + + - name: Build UI + run: make ui + - name: Build - run: mkdir dist && touch dist/empty && make build + run: make build + + - name: Cache dist + uses: actions/cache/save@v3 + id: cache-dist + with: + path: dist + key: ${{ runner.os }}-${{ github.sha }}-dist + + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: evcc-binary + path: ./evcc test: name: Test @@ -92,7 +115,7 @@ jobs: version: latest args: --timeout 5m - build-ui: + ui: name: UI runs-on: ubuntu-latest @@ -104,7 +127,7 @@ jobs: node-version: "18" cache: "npm" - - name: Install tools + - name: Install run: make install-ui - name: Lint @@ -113,12 +136,49 @@ jobs: - name: Test run: make test-ui - - name: Build - run: make ui + - name: Porcelain + run: | + test -z "$(git status --porcelain)" || (git status; git diff; false) - - name: Cache dist - uses: actions/cache/save@v3 - id: cache-dist + integration: + name: Integration + runs-on: ubuntu-latest + if: ${{ github.event_name != 'workflow_call' }} + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 with: - path: dist - key: ${{ runner.os }}-${{ github.sha }}-dist + node-version: "18" + cache: "npm" + + - name: Install npm + run: npm ci + + - run: npx playwright install --with-deps chromium + + - name: Wait for Build + uses: lewagon/wait-on-check-action@v1.3.1 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + check-name: Build + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + + - uses: actions/download-artifact@v3 + with: + name: evcc-binary + + - name: Make executable + run: chmod +x evcc + + - name: Run tests + run: npx playwright test + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.gitignore b/.gitignore index 9da0cd4c1..5d5fc691e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ __debug_bin !util/templates/**/*.yaml !package*.json !evcc.dist.yaml +!tests/**/*.evcc.yaml evcc evcc.exe evcc_* @@ -32,3 +33,6 @@ fly.toml vendor/* QEMU_EFI.fd asset-stats.html +/test-results/ +/playwright-report/ +/playwright/.cache/ diff --git a/assets/js/components/Energyflow/Visualization.vue b/assets/js/components/Energyflow/Visualization.vue index 57745dd67..53aa89d14 100644 --- a/assets/js/components/Energyflow/Visualization.vue +++ b/assets/js/components/Energyflow/Visualization.vue @@ -1,5 +1,9 @@