Repository navigation
Apply width and height to the DOM, reuse a host-loaded bundle, hand o… #51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| # check - lint, the Node tests of the control, format, the package contents, | |
| # and the packed package built in an app of its own with UI5 CLI 3 | |
| # and 4 | |
| # floor - the backend floor the package records, for the samples job | |
| # samples - the examples in abap2UI5/samples-embed-control (its main), with | |
| # the control of THIS commit in place of the one from npm: the | |
| # packed package unpacked into node_modules/@abap2ui5/embed-control | |
| # of the checkout, where every example takes it from. Then, as | |
| # samples-embed-control's own CI does with the published control: | |
| # its branch build (npm run bsp, with abap2UI5's BSP tools from its | |
| # main) and its e2e tests in a browser against a live abap2UI5 | |
| # backend, transpiled to JavaScript and served by its express | |
| # server - no SAP system involved. The control loads the frontend | |
| # from that backend (?z2ui5-bundle), so what is tested is the pair a | |
| # user gets: this control and an abap2UI5. Twice: against abap2UI5 | |
| # main (npm run express in a checkout), and against the backend | |
| # floor the package records - "abap2ui5".minBackend in | |
| # packages/embed-control/package.json, abap2UI5 1.145.0 today - the | |
| # published @abap2ui5/node-runtime of that version (job floor reads | |
| # it, so the leg cannot drift from the package). The floor leg | |
| # leaves out what 1.145.0 cannot do: the Fiori elements examples and | |
| # the tests tagged @after-<floor> need a frontend that leaves the | |
| # URL hash to the host (the release after it) | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| # abap2UI5 and the examples change without a pull request here, and the | |
| # samples job tests against their current main - so everything runs every | |
| # night as well, and a change there that breaks the control shows up the | |
| # next morning | |
| schedule: | |
| - cron: "23 4 * * *" | |
| workflow_dispatch: | |
| # publish.yaml runs all of it on the commit it publishes | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run lint | |
| if: ${{ !cancelled() }} | |
| - run: npm test | |
| if: ${{ !cancelled() }} | |
| - run: npm run format:check | |
| if: ${{ !cancelled() }} | |
| - run: npm run pack:check | |
| if: ${{ !cancelled() }} | |
| # the tarball, installed into an app outside this workspace and built | |
| # with UI5 CLI 3 and 4 - what a consumer gets, on every CLI major a | |
| # consumer may have | |
| - run: npm run consumer:check | |
| if: ${{ !cancelled() }} | |
| # the backend floor the package states - "abap2ui5".minBackend in its | |
| # package.json - for the samples leg against it. Read from the file rather | |
| # than written here again, so the version the leg installs is the version | |
| # the package names. Raise it there, with the README | |
| floor: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| backend: ${{ steps.read.outputs.backend }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| sparse-checkout: packages/embed-control/package.json | |
| sparse-checkout-cone-mode: false | |
| - id: read | |
| run: | | |
| backend=$(jq -er '.abap2ui5.minBackend' packages/embed-control/package.json) | |
| echo "$backend" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' | |
| echo "backend=$backend" >> "$GITHUB_OUTPUT" | |
| echo "the backend floor is abap2UI5 $backend" | |
| samples: | |
| name: samples (abap2UI5 ${{ matrix.backend }}) | |
| needs: floor | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - backend: main | |
| playwright-args: "" | |
| # the floor, from the package (job floor). A test that needs a | |
| # newer backend is tagged @after-<floor>, and the leg leaves it | |
| # out - with the floor raised, it runs. The project names and the | |
| # tag are samples-embed-control's (its playwright.config.mjs and | |
| # its ci.yaml, which names the same) | |
| - backend: ${{ needs.floor.outputs.backend }} | |
| playwright-args: >- | |
| --project ui5-1.136 --project ui5-1.71 --project card | |
| --grep-invert @after-${{ needs.floor.outputs.backend }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: abap2UI5/samples-embed-control | |
| path: .samples | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: ${{ matrix.backend == 'main' }} | |
| with: | |
| repository: abap2UI5/abap2UI5 | |
| path: .abap2ui5 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| cache-dependency-path: | | |
| .samples/package-lock.json | |
| .abap2ui5/package-lock.json | |
| - name: Build the abap2UI5 backend | |
| if: ${{ matrix.backend == 'main' }} | |
| working-directory: .abap2ui5 | |
| run: | | |
| npm ci | |
| npm run downport | |
| npm run auto_transpile | |
| - name: Install the published abap2UI5 ${{ matrix.backend }} | |
| if: ${{ matrix.backend != 'main' }} | |
| run: | | |
| mkdir .abap2ui5 && cd .abap2ui5 | |
| # a manifest of its own: `npm init -y` names the package after the | |
| # directory, and ".abap2ui5" is no valid package name | |
| printf '{ "name": "abap2ui5-backend", "private": true }\n' > package.json | |
| npm install --no-audit --no-fund \ | |
| "@abap2ui5/node-runtime@${{ matrix.backend }}" express@5 | |
| cat > serve.mjs <<'EOF' | |
| import { serve } from "@abap2ui5/node-runtime"; | |
| await serve({ port: 3000, host: "127.0.0.1" }); | |
| EOF | |
| - name: Start it on port 3000 | |
| working-directory: .abap2ui5 | |
| run: | | |
| if [ "${{ matrix.backend }}" = main ]; then | |
| HOST=127.0.0.1 PORT=3000 nohup npm run express > "$RUNNER_TEMP/express.log" 2>&1 & | |
| else | |
| nohup node serve.mjs > "$RUNNER_TEMP/express.log" 2>&1 & | |
| fi | |
| for i in $(seq 1 60); do | |
| curl -s -o /dev/null http://127.0.0.1:3000/ && exit 0 | |
| sleep 1 | |
| done | |
| cat "$RUNNER_TEMP/express.log" | |
| exit 1 | |
| - run: npm ci | |
| working-directory: .samples | |
| # The examples take the control from the root of their workspace, one | |
| # copy for all (samples-embed-control's ci.yaml checks that) - this | |
| # commit's, packed as npm would publish it, goes there instead | |
| - name: The examples run the control of this commit | |
| run: | | |
| set -euo pipefail | |
| tarball=$(npm pack --json --workspace packages/embed-control --pack-destination "$RUNNER_TEMP" \ | |
| | node -p "JSON.parse(require('fs').readFileSync(0, 'utf8'))[0].filename") | |
| dest=.samples/node_modules/@abap2ui5/embed-control | |
| test -d "$dest" | |
| for example in .samples/*/package.json; do | |
| test ! -e "$(dirname "$example")/node_modules/@abap2ui5/embed-control" | |
| done | |
| rm -rf "$dest" | |
| mkdir -p "$dest" | |
| tar -xzf "$RUNNER_TEMP/$tarball" -C "$dest" --strip-components 1 | |
| echo "$(node -p "require('./$dest/package.json').version") of $GITHUB_SHA in $dest" | |
| # the branches samples-embed-control delivers, with this control: the | |
| # BSP tools are the ones of the abap2UI5 checkout of this leg | |
| - name: The branch build of the examples | |
| if: ${{ matrix.backend == 'main' }} | |
| working-directory: .samples | |
| run: npm run bsp | |
| env: | |
| ABAP2UI5_DIR: ${{ github.workspace }}/.abap2ui5 | |
| - run: npx playwright install --with-deps chromium | |
| working-directory: .samples | |
| - run: npx playwright test ${{ matrix.playwright-args }} | |
| working-directory: .samples | |
| env: | |
| CI: "true" | |
| - if: ${{ failure() }} | |
| run: cat "$RUNNER_TEMP/express.log" | |
| - if: ${{ failure() }} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: playwright-report-${{ matrix.backend }} | |
| path: .samples/playwright-report/ | |
| retention-days: 7 |