ci: Reduce amount of workflows #2185
Workflow file for this run
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: QA | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: QA-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
quality-go: | |
name: "Quality checks / Go" | |
strategy: | |
fail-fast: false | |
matrix: | |
subproject: [ | |
"agentapi", | |
"common", | |
"contractsapi", | |
"end-to-end", | |
"mocks", | |
"storeapi/go-wrapper/microsoftstore", | |
"windows-agent", | |
"wsl-pro-service", | |
] | |
os: [ubuntu, windows] | |
exclude: | |
# Skipping because it only builds on Linux (uses syscall.Kill()) | |
- subproject: wsl-pro-service | |
os: windows | |
# Skipping because it only builds on Windows (registry access) | |
- subproject: end-to-end | |
os: ubuntu | |
include: | |
# Enabling Flutter to generate gRPC bindings | |
- subproject: agentapi | |
needs-flutter: true | |
# Skipping tests because common/i18n subprocesses gettext | |
- os: ubuntu | |
subproject: common | |
skip-tests: true | |
# Skipping tests because we run them in the qa-azure workflow | |
- subproject: end-to-end | |
skip-tests: true | |
# Skipping tests because we need MsBuild | |
- subproject: storeapi/go-wrapper/microsoftstore | |
os: ubuntu | |
skip-tests: true | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- name: Set up git | |
# This step needs to be done before checkout so that the checkout respects clrf | |
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Load flutter version | |
if: matrix.needs-flutter != '' | |
id: load | |
uses: ./.github/actions/load-json | |
with: | |
path: tools/versions.json | |
- name: Set up flutter | |
uses: subosito/flutter-action@v2 | |
if: matrix.needs-flutter != '' | |
with: | |
channel: 'stable' | |
flutter-version: ${{ steps.load.outputs.data.flutter-version }} | |
- name: Install Dart protoc plugin | |
if: matrix.needs-flutter != '' | |
shell: bash | |
working-directory: ${{ matrix.subproject }} | |
run: | | |
dart pub global activate protoc_plugin | |
- name: Quality check | |
uses: canonical/desktop-engineering/gh-actions/go/code-sanity@main | |
with: | |
working-directory: ${{ matrix.subproject }} | |
go-tags: gowslmock | |
tools-directory: ${{ github.workspace }}/tools | |
golangci-lint-configfile: ${{ github.workspace }}/.golangci.yaml | |
- name: Gettext validation | |
shell: bash | |
working-directory: ${{ matrix.subproject }} | |
run: | | |
set -eu | |
tmp=`mktemp` | |
grep -nr --include="*.go" 'i18n.G([^"]' ./* | grep -Pv '_test.go:' > "${tmp}/log" || true | |
[ -z "$(cat "${tmp}/log")" ] && exit 0 | |
echo 'Bad i18n.G calls. Gettext will only detect calls of type G("text"), with double quotes.' | |
cat "${tmp}/log" | |
exit 1 | |
# The Windows Store needs to be built. The tests do it automatically, but they need | |
# msbuild in the path. | |
- name: Set up MSBuild | |
uses: microsoft/setup-msbuild@v1 | |
if: matrix.subproject == 'storeapi/go-wrapper/microsoftstore' && matrix.skip-tests == '' | |
- name: Run tests | |
shell: bash | |
if: matrix.skip-tests == '' | |
working-directory: ${{ matrix.subproject }} | |
run: | | |
go test -shuffle=on -coverpkg=./... -coverprofile=/tmp/coverage.out -covermode=count ./... -tags=gowslmock | |
- name: Run tests (with race detector) | |
shell: bash | |
# -race not supported on Windows | |
if: matrix.os != 'windows' && matrix.skip-tests == '' | |
working-directory: ${{ matrix.subproject }} | |
run: | | |
go test -shuffle=on ./... -race -tags=gowslmock | |
#- name: Upload coverage to Codecov | |
# uses: codecov/codecov-action@v3 | |
# if: matrix.skip-tests == '' | |
# with: | |
# file: /tmp/coverage.out | |
quality-flutter: | |
name: "Quality checks / Flutter" | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ["p4w_ms_store", "ubuntupro"] | |
os: [ubuntu, windows] | |
include: | |
# We'll be able to run this on Linux eventually and there are gotchas already solved here | |
# such as the dependency on xvfb since ubuntu runners on GH don't have graphical capabilities. | |
- os: ubuntu | |
skip-tests: true | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- name: Set up git | |
# This step needs to be done before checkout so that the checkout respects clrf | |
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Ensure dependencies on Ubuntu | |
if: ${{ matrix.os == 'ubuntu' }} | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt update | |
sudo DEBIAN_FRONTEND=noninteractive apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev unzip xvfb | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
# We need to set up Go so that the agent can be built for the end-to-end tests | |
if: matrix.package == 'ubuntupro' | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: windows-agent/go.mod | |
- name: Load flutter version | |
id: load | |
uses: ./.github/actions/load-json | |
with: | |
path: tools/versions.json | |
- name: Flutter QA | |
uses: ./.github/actions/flutter-qa/ | |
with: | |
flutter-version: ${{ steps.load.outputs.data.flutter-version }} | |
package-dir: gui/packages/${{ matrix.package }} | |
run-build-runner: ${{ matrix.package == 'ubuntupro' }} | |
- name: Ensure module files are up to date | |
uses: canonical/desktop-engineering/gh-actions/common/has-diff@main | |
with: | |
working-directory: gui/packages/${{ matrix.package }} | |
paths-to-ignore: ${{ matrix.package == 'ubuntupro' && 'pubspec.lock' || '' }} | |
fail-on-diff: true | |
- name: Flutter QA | |
uses: ./.github/actions/flutter-integration-test/ | |
if: matrix.skip-tests == '' | |
with: | |
flutter-version: ${{ steps.load.outputs.data.flutter-version }} | |
go-version-file: windows-agent/go.mod | |
# Only the app entry point is expected to have integration tests | |
package-dir: 'gui/packages/ubuntupro' | |
quality-cpp: | |
name: "Quality Checks / C++" | |
runs-on: windows-latest | |
steps: | |
- name: Set up git | |
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: C++ QA | |
uses: ./.github/actions/cpp-qa/ | |
with: | |
subproject-dir: 'storeapi/test' |