Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select targets to run tests on in GitHub Actions #5507

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 71 additions & 9 deletions .github/workflows/desktop-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,67 @@
name: Desktop - End-to-end tests

Check warning on line 1 in .github/workflows/desktop-e2e.yml

View workflow job for this annotation

GitHub Actions / check-formatting

1:1 [document-start] missing document start "---"
on:

Check warning on line 2 in .github/workflows/desktop-e2e.yml

View workflow job for this annotation

GitHub Actions / check-formatting

2:1 [truthy] truthy value should be one of [false, true]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
oses:
description: 'List of OSes to run tests on, e.g. "debian11 debian12"'
default: ''
required: false
type: string
jobs:
prepare-matrices:
runs-on: ubuntu-latest
steps:
- name: Generate matrix for Linux builds
shell: bash
run: |
all='["debian11","debian12","ubuntu2004","ubuntu2204","ubuntu2304","fedora38","fedora37","fedora36"]'
oses="${{ github.event.inputs.oses }}"
if [[ -z "$oses" || "$oses" == "null" ]]; then
selected="$all"
else
oses=$(printf '%s\n' "$oses" | jq . -R | jq . -s)
selected=$(jq -cn --argjson oses "$oses" --argjson all "$all" '$all - ($all - $oses)')
fi
echo "Selected targets: $selected"
echo "linux_matrix=$selected" >> $GITHUB_ENV
- name: Generate matrix for Windows builds
shell: bash
run: |
all='["windows10","windows11"]'
oses="${{ github.event.inputs.oses }}"
if [[ -z "$oses" || "$oses" == "null" ]]; then
selected="$all"
else
oses=$(printf '%s\n' "$oses" | jq . -R | jq . -s)
selected=$(jq -cn --argjson oses "$oses" --argjson all "$all" '$all - ($all - $oses)')
fi
echo "Selected targets: $selected"
echo "windows_matrix=$selected" >> $GITHUB_ENV
- name: Generate matrix for macOS builds
shell: bash
run: |
all='["macos12","macos13","macos14"]'
oses="${{ github.event.inputs.oses }}"
if [[ -z "$oses" || "$oses" == "null" ]]; then
selected="$all"
else
oses=$(printf '%s\n' "$oses" | jq . -R | jq . -s)
selected=$(jq -cn --argjson oses "$oses" --argjson all "$all" '$all - ($all - $oses)')
fi
echo "Selected targets: $selected"
echo "macos_matrix=$selected" >> $GITHUB_ENV
outputs:
linux_matrix: ${{ env.linux_matrix }}
windows_matrix: ${{ env.windows_matrix }}
macos_matrix: ${{ env.macos_matrix }}

prepare-linux:
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}
needs: prepare-matrices
if: |
needs.prepare-matrices.outputs.linux_matrix != '[]' &&
!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -54,14 +110,14 @@

e2e-test-linux:
name: Linux end-to-end tests
needs: build-linux
needs: [prepare-matrices, build-linux]
if: '!cancelled()'
runs-on: [self-hosted, desktop-test, Linux] # app-test-linux

Check warning on line 115 in .github/workflows/desktop-e2e.yml

View workflow job for this annotation

GitHub Actions / check-formatting

115:49 [comments] too few spaces before comment
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os: [debian11, debian12, ubuntu2004, ubuntu2204, ubuntu2304, fedora38, fedora37, fedora36]
os: ${{ fromJSON(needs.prepare-matrices.outputs.linux_matrix) }}
steps:
- uses: actions/download-artifact@v3
if: ${{ needs.build-linux.result == 'success' }}
Expand All @@ -82,7 +138,10 @@
path: ./test/.ci-logs/${{ matrix.os }}_report

build-windows:
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}
needs: prepare-matrices
if: |
needs.prepare-matrices.outputs.windows_matrix != '[]' &&
!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'
runs-on: windows-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -122,15 +181,15 @@
path: .\dist\*.exe

e2e-test-windows:
needs: build-windows
needs: [prepare-matrices, build-windows]
if: '!cancelled()'
name: Windows end-to-end tests
runs-on: [self-hosted, desktop-test, Linux] # app-test-linux

Check warning on line 187 in .github/workflows/desktop-e2e.yml

View workflow job for this annotation

GitHub Actions / check-formatting

187:49 [comments] too few spaces before comment
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os: [windows10, windows11]
os: ${{ fromJSON(needs.prepare-matrices.outputs.windows_matrix) }}
steps:
- uses: actions/download-artifact@v3
if: ${{ needs.build-windows.result == 'success' }}
Expand All @@ -151,8 +210,11 @@
path: ./test/.ci-logs/${{ matrix.os }}_report

build-macos:
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}
needs: prepare-matrices
if: |
needs.prepare-matrices.outputs.macos_matrix != '[]' &&
!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'
runs-on: [self-hosted, desktop-test, macOS] # app-test-macos-arm

Check warning on line 217 in .github/workflows/desktop-e2e.yml

View workflow job for this annotation

GitHub Actions / check-formatting

217:49 [comments] too few spaces before comment
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -185,15 +247,15 @@
./dist/app-e2e-*

e2e-test-macos:
needs: build-macos
needs: [prepare-matrices, build-macos]
if: '!cancelled()'
name: macOS end-to-end tests
runs-on: [self-hosted, desktop-test, macOS] # app-test-macos-arm

Check warning on line 253 in .github/workflows/desktop-e2e.yml

View workflow job for this annotation

GitHub Actions / check-formatting

253:49 [comments] too few spaces before comment
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-13, macos-12]
os: ${{ fromJSON(needs.prepare-matrices.outputs.macos_matrix) }}
steps:
- uses: actions/download-artifact@v3
if: ${{ needs.build-macos.result == 'success' }}
Expand Down
Loading