From 5d31beaf03ed8fa4e5772ab498e110a2b48b9cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 4 Aug 2023 11:23:02 +0200 Subject: [PATCH 1/3] Run the integration tests only when needed Use path patterns in the GutHub Action to set when they should be started --- .github/workflows/ci-integration-tests.yml | 164 +++++++++++++++++++++ .github/workflows/ci.yml | 83 ----------- 2 files changed, 164 insertions(+), 83 deletions(-) create mode 100644 .github/workflows/ci-integration-tests.yml diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml new file mode 100644 index 0000000000..b831c0e145 --- /dev/null +++ b/.github/workflows/ci-integration-tests.yml @@ -0,0 +1,164 @@ +name: "CI - Integration Tests" + +on: + push: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used below for the pull request event. Keep both lists in sync!! + + # this file itself + - .github/workflows/ci-integration-tests.yml + + # the web frontend + - web/**.json + - web/**.html + - web/**.scss + - web/**.jsx? + # ignore unit tests, we do not run them here + - "!web/**.test.jsx?" + - web/Makefile + + # the service backend + - setup-service.sh + - service/lib/**.rb + - service/bin/agamactl + - service/Gemfile* + - service/*.gemspec + # D-Bus and systemd configs + - service/share/*.conf + - service/share/*.service + # Rust services + - rust/Cargo.lock + - rust/agama-dbus-server/** + - rust/agama-locale-data/** + - rust/agama-lib/** + # ignore the JSON profile and the examples + - "!rust/agama-lib/share/**" + - rust/share/*.service + + # the playwright tests and configs + - playwright/**.ts + - playwright/config/agama.yaml + + pull_request: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used above for the push event. Keep both lists in sync!! + + # this file itself + - .github/workflows/ci-integration-tests.yml + + # the web frontend + - web/**.json + - web/**.html + - web/**.scss + - web/**.jsx? + # ignore unit tests, we do not run them here + - "!web/**.test.jsx?" + - web/Makefile + + # the service backend + - setup-service.sh + - service/lib/**.rb + - service/bin/agamactl + - service/Gemfile* + - service/*.gemspec + # D-Bus and systemd configs + - service/share/*.conf + - service/share/*.service + # Rust services + - rust/Cargo.lock + - rust/agama-dbus-server/** + - rust/agama-locale-data/** + - rust/agama-lib/** + # ignore the JSON profile and the examples + - "!rust/agama-lib/share/**" + - rust/share/*.service + + # the playwright tests and configs + - playwright/**.ts + - playwright/config/agama.yaml + +jobs: + integration-tests: + timeout-minutes: 60 + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + # TW is needed because of the Cockpit packages + distro: [ "tumbleweed" ] + + steps: + + # TODO: Reuse/share building the frontend and backend with the other steps + # TODO: Cache the Ruby gems and node packages + + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Created shared YaST log directory + run: mkdir -p /tmp/log/YaST2 + + - name: Start container + run: podman run --privileged --detach --name agama --ipc=host -e CI -e GITHUB_ACTIONS -v /dev:/dev -v .:/checkout -v /tmp/log/YaST2:/var/log/YaST2 registry.opensuse.org/yast/head/containers/containers_tumbleweed/opensuse/agama-testing:latest + + - name: Environment + run: podman exec agama bash -c "env | sort" + + - name: Build the frontend + run: podman exec agama bash -c "cd /checkout/web && npm install && make" + + - name: Install the frontend + run: podman exec agama bash -c "ln -snfv /checkout/web/dist /usr/share/cockpit/agama" + + # ./setup-service.sh will try setting up cockpit.socket + # which has a login page, so this local-session needs to be first + - name: Start Cockpit service + run: podman exec --detach agama /usr/libexec/cockpit-ws --local-session=/usr/bin/cockpit-bridge + + - name: Setup service + run: podman exec agama bash -c "cd /checkout; ./setup-service.sh" + + - name: Set a testing Agama configuration + # copy a simplified ALP config file, it skips the product selection at the beginning + run: podman exec agama bash -c "cp /checkout/playwright/config/agama.yaml /checkout/service/etc/agama.yaml" + + - name: Show NetworkManager log + run: podman exec agama journalctl -u NetworkManager + + - name: Show the D-Bus services log + run: podman exec agama bash -c "journalctl | grep agama" + + - name: Check DBus socket + run: podman exec agama ls -l /var/run/dbus/system_bus_socket + + - name: Run the Agama smoke test + run: podman exec agama curl http://localhost:9090/cockpit/@localhost/agama/index.html + + - name: Check Playwright version + run: podman exec agama playwright --version + + - name: Run the Playwright tests + # user authentication is not required when cockpit runs a local session + # run the tests in the Chromium browser + run: podman exec agama bash -c "cd /checkout/playwright && SKIP_LOGIN=true playwright test --trace on --project chromium" + + - name: Again show the D-Bus services log + run: podman exec agama bash -c "journalctl | grep agama" + + - name: Show the complete journal + # maybe not necessary if the above filtered journalctl calls are enough + run: podman exec agama journalctl -b || echo "journal failed with $?" + + - name: Upload the test results + uses: actions/upload-artifact@v3 + # run even when the previous step fails + if: always() + with: + name: test-results + retention-days: 30 + path: | + playwright/test-results/**/* + /tmp/log/YaST2/y2log diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e0775f611..71d4a62823 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,89 +217,6 @@ jobs: flag-name: rust-backend parallel: true - integration-tests: - timeout-minutes: 60 - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - # TW is needed because of the Cockpit packages - distro: [ "tumbleweed" ] - - steps: - - # TODO: Reuse/share building the frontend and backend with the other steps - # TODO: Cache the Ruby gems and node packages - - - name: Git Checkout - uses: actions/checkout@v3 - - - name: Created shared YaST log directory - run: mkdir -p /tmp/log/YaST2 - - - name: Start container - run: podman run --privileged --detach --name agama --ipc=host -e CI -e GITHUB_ACTIONS -v /dev:/dev -v .:/checkout -v /tmp/log/YaST2:/var/log/YaST2 registry.opensuse.org/yast/head/containers/containers_tumbleweed/opensuse/agama-testing:latest - - - name: Environment - run: podman exec agama bash -c "env | sort" - - - name: Build the frontend - run: podman exec agama bash -c "cd /checkout/web && npm install && make" - - - name: Install the frontend - run: podman exec agama bash -c "ln -snfv /checkout/web/dist /usr/share/cockpit/agama" - - # ./setup-service.sh will try setting up cockpit.socket - # which has a login page, so this local-session needs to be first - - name: Start Cockpit service - run: podman exec --detach agama /usr/libexec/cockpit-ws --local-session=/usr/bin/cockpit-bridge - - - name: Setup service - run: podman exec agama bash -c "cd /checkout; ./setup-service.sh" - - - name: Set a testing Agama configuration - # copy a simplified ALP config file, it skips the product selection at the beginning - run: podman exec agama bash -c "cp /checkout/playwright/config/agama.yaml /checkout/service/etc/agama.yaml" - - - name: Show NetworkManager log - run: podman exec agama journalctl -u NetworkManager - - - name: Show the D-Bus services log - run: podman exec agama bash -c "journalctl | grep agama" - - - name: Check DBus socket - run: podman exec agama ls -l /var/run/dbus/system_bus_socket - - - name: Run the Agama smoke test - run: podman exec agama curl http://localhost:9090/cockpit/@localhost/agama/index.html - - - name: Check Playwright version - run: podman exec agama playwright --version - - - name: Run the Playwright tests - # user authentication is not required when cockpit runs a local session - # run the tests in the Chromium browser - run: podman exec agama bash -c "cd /checkout/playwright && SKIP_LOGIN=true playwright test --trace on --project chromium" - - - name: Again show the D-Bus services log - run: podman exec agama bash -c "journalctl | grep agama" - - - name: Show the complete journal - # maybe not necessary if the above filtered journalctl calls are enough - run: podman exec agama journalctl -b || echo "journal failed with $?" - - - name: Upload the test results - uses: actions/upload-artifact@v3 - # run even when the previous step fails - if: always() - with: - name: test-results - retention-days: 30 - path: | - playwright/test-results/**/* - /tmp/log/YaST2/y2log - finish: runs-on: ubuntu-latest From 1568d09e60248dae7037d83a0c28dbc54da6f6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 4 Aug 2023 13:07:51 +0200 Subject: [PATCH 2/3] README - Added integration badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b12c27f19e..92ae0e38eb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ **Checks** [![CI Status](https://github.com/openSUSE/agama/actions/workflows/ci.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/ci.yml) +[![CI - Integration Tests](https://github.com/openSUSE/agama/actions/workflows/ci-integration-tests.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/ci-integration-tests.yml) [![Coverage Status](https://coveralls.io/repos/github/openSUSE/agama/badge.svg?branch=master)](https://coveralls.io/github/openSUSE/agama?branch=master) [![GitHub Pages](https://github.com/openSUSE/agama/actions/workflows/github-pages.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/github-pages.yml) From f127e0d6e5439e0cd7fcda5090c381ecfba01217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 4 Aug 2023 14:47:53 +0200 Subject: [PATCH 3/3] Update .github/workflows/ci-integration-tests.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Imobach González Sosa --- .github/workflows/ci-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml index b831c0e145..6f03cbef78 100644 --- a/.github/workflows/ci-integration-tests.yml +++ b/.github/workflows/ci-integration-tests.yml @@ -131,7 +131,7 @@ jobs: - name: Show the D-Bus services log run: podman exec agama bash -c "journalctl | grep agama" - - name: Check DBus socket + - name: Check D-Bus socket run: podman exec agama ls -l /var/run/dbus/system_bus_socket - name: Run the Agama smoke test