refactor: move tester navigation out of integration tests #2934
This file contains 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 | |
on: | |
push: | |
branches: | |
- main | |
- ubuntu/** | |
pull_request: | |
branches: | |
- main | |
- ubuntu/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
flutter-analyze: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- run: melos analyze --fatal-infos | |
bootstrap: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
target: | |
- ubuntu_bootstrap_test.dart | |
- screenshot_test.dart | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- run: | | |
sudo apt update | |
sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip | |
sudo apt install -y dbus-x11 network-manager upower | |
make install_deps | |
- run: | | |
sudo loginctl enable-linger $USER | |
sudo systemctl start user@$UID.service | |
echo "XDG_RUNTIME_DIR=/run/user/$UID" >> $GITHUB_ENV | |
# write any setting to force-start dconf.service (via xvfb because dbus-launch needs a display) | |
xvfb-run -a gsettings set org.gnome.desktop.interface color-scheme "'default'" | |
- run: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test/${{matrix.target}} | |
working-directory: packages/ubuntu_bootstrap | |
env: | |
SUBIQUITY_REPLAY_TIMESCALE: 100 | |
flutter-format: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- run: melos format:exclude | |
init-e2e: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip | |
sudo apt install -y gnome-initial-setup network-manager | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "./provd/go.mod" | |
- name: Build provd | |
run: go build ./cmd/provd | |
working-directory: provd | |
- name: Run provd | |
run: | | |
set -ux | |
set +e | |
mv provd/example.config.yaml provd/provd.yaml | |
sudo mkdir -p /run/gnome-initial-setup/desktop-provision | |
sudo chown $USER /run/gnome-initial-setup/desktop-provision | |
sudo provd/provd & | |
until [ -S /run/gnome-initial-setup/desktop-provision/init.socket ]; do | |
sleep 1 | |
done | |
sudo chmod go+rw /run/gnome-initial-setup/desktop-provision/init.socket | |
- run: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test/e2e_test.dart | |
working-directory: packages/ubuntu_init | |
init: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
target: | |
- ubuntu_init_test.dart | |
- screenshot_test.dart | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- run: sudo apt update | |
- run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip | |
- run: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test/${{matrix.target}} | |
working-directory: packages/ubuntu_init | |
flutter-mocks: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- run: melos generate | |
- name: Check for outdated mocks | |
if: github.event_name == 'pull_request' | |
run: ./.github/scripts/check-outdated-files.sh | |
- name: Create PR | |
if: github.event_name == 'push' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
add-paths: "**/*.mocks.dart" | |
title: "chore: regenerate mocks" | |
commit-message: "chore: regenerate mocks" | |
branch: create-pull-request/mocks | |
delete-branch: true | |
l10n: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- run: melos gen-l10n | |
- name: Check for outdated l10n | |
if: github.event_name == 'pull_request' | |
run: ./.github/scripts/check-outdated-files.sh | |
- name: Create PR | |
if: github.event_name == 'push' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
add-paths: "**/l10n/*.dart" | |
title: "chore: regenerate l10n" | |
commit-message: "chore: regenerate l10n" | |
branch: create-pull-request/l10n | |
delete-branch: true | |
flutter-tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update && sudo apt install lcov | |
make install_deps | |
- name: Setup environment | |
run: | | |
sudo loginctl enable-linger $USER | |
sudo systemctl start user@$UID.service | |
echo "XDG_RUNTIME_DIR=/run/user/$UID" >> $GITHUB_ENV | |
- run: melos coverage | |
- uses: codecov/codecov-action@v4 | |
with: | |
flags: UI | |
token: ${{secrets.CODECOV_TOKEN}} | |
- name: Cache coverage files | |
uses: actions/cache@v4 | |
with: | |
path: packages/*/coverage/lcov.info | |
key: ${{ github.sha }}-flutter-test-coverage | |
go-sanity: | |
name: "Go: Code sanity" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y libgtk-3-dev | |
- uses: actions/checkout@v4 | |
- name: Go code sanity check | |
uses: canonical/desktop-engineering/gh-actions/go/code-sanity@main | |
with: | |
golangci-lint-configfile: ".golangci.yaml" | |
tools-directory: "./provd/tools" | |
working-directory: "./provd" | |
- name: Build cmd/provd | |
run: | | |
set -eu | |
cd provd | |
go build ./cmd/provd | |
go-tests: | |
name: "Go: Tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y libgtk-3-dev debhelper dh-golang golang-go | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "./provd/go.mod" | |
- name: Run tests | |
run: | | |
set -eu | |
cd provd | |
go test -coverpkg=./... -coverprofile=/tmp/coverage.out -covermode=set ./... -shuffle=on | |
- name: Run tests (with race detector) | |
run: | | |
cd provd | |
go test -race ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: /tmp/coverage.out | |
flags: provd | |
token: ${{secrets.CODECOV_TOKEN}} | |
- name: Cache coverage files | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/coverage.out | |
key: ${{ github.sha }}-go-test-coverage | |
build-and-upload: | |
if: github.event_name == 'push' | |
needs: go-tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [x86_64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: matrix.platform == 'arm64' | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: matrix.platform == 'arm64' | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Debian package in Ubuntu Docker container | |
run: | | |
if [ "${{ matrix.platform }}" == "x86_64" ]; then | |
docker run --rm -v $(pwd):/workspace -w /workspace/provd ubuntu:noble bash -c " | |
apt-get update && | |
apt-get install -y libgtk-3-dev debhelper dh-golang golang-go && | |
dpkg-buildpackage -us -uc -b && | |
mv ../provd_*.deb ../provd-${{ matrix.platform }}.deb | |
" | |
else | |
docker run --rm --platform linux/arm64 -v $(pwd):/workspace -w /workspace/provd ubuntu:noble bash -c " | |
apt-get update && | |
apt-get install -y libgtk-3-dev libglib2.0-dev debhelper dh-golang golang-go && | |
dpkg-buildpackage -us -uc -b && | |
mv ../provd_*.deb ../provd-${{ matrix.platform }}.deb | |
" | |
fi | |
- name: Upload Debian package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: provd-deb-package-${{ matrix.platform }} | |
path: provd-${{ matrix.platform }}.deb | |
tics-coverage: | |
name: Convert and upload coverage reports for TiCS | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: | |
- flutter-tests | |
- go-tests | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: asdf-vm/actions/install@v3 | |
- uses: bluefireteam/melos-action@v3 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: "./provd/go.mod" | |
- name: Restore Flutter coverage files from cache | |
uses: actions/cache@v4 | |
with: | |
path: packages/*/coverage/lcov.info | |
key: ${{ github.sha }}-flutter-test-coverage | |
- name: Restore Go coverage files from cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/coverage.out | |
key: ${{ github.sha }}-go-test-coverage | |
- name: Install dependencies | |
run: | | |
dart pub global activate cobertura | |
go install github.com/axw/gocov/gocov@latest | |
go install github.com/AlekSi/gocov-xml@latest | |
- name: Convert Flutter coverage files to cobertura XML | |
run: | | |
mkdir coverage | |
for package in provd_client subiquity_client subiquity_test ubuntu_bootstrap ubuntu_init ubuntu_provision ubuntu_utils ubuntu_wizard; do | |
pushd packages/$package | |
cobertura convert | |
sed -i 's/branches-covered/decisions-covered/g' coverage/cobertura.xml | |
mv coverage/cobertura.xml ../../coverage/$package.xml | |
popd | |
done | |
- name: Convert Go coverage files to cobertura XML | |
run: | | |
gocov convert /tmp/coverage.out | gocov-xml > coverage/report_co.xml | |
- name: Upload coverage reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tics-coverage-reports | |
path: coverage/* |