summaryrefslogtreecommitdiffhomepage
path: root/.github
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2023-11-27 12:52:02 +0100
committerDavid Lönnhager <david.l@mullvad.net>2023-11-28 12:02:09 +0100
commita3f9fa941144ff2d18b921c1f60fa3baec3afa07 (patch)
tree8558cf7a554749b1b38526bd2389795982dfb790 /.github
parente28609bdb57c8f11f92780b36cdd77db74f406b8 (diff)
downloadmullvadvpn-a3f9fa941144ff2d18b921c1f60fa3baec3afa07.tar.xz
mullvadvpn-a3f9fa941144ff2d18b921c1f60fa3baec3afa07.zip
Select targets to run tests on in GitHub Actions
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/desktop-e2e.yml81
1 files changed, 72 insertions, 9 deletions
diff --git a/.github/workflows/desktop-e2e.yml b/.github/workflows/desktop-e2e.yml
index cd10128bc8..9254166bd5 100644
--- a/.github/workflows/desktop-e2e.yml
+++ b/.github/workflows/desktop-e2e.yml
@@ -3,9 +3,66 @@ on:
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 }}"
+ echo "OSES: $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
@@ -54,14 +111,14 @@ jobs:
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
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' }}
@@ -82,7 +139,10 @@ jobs:
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
@@ -122,7 +182,7 @@ jobs:
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
@@ -130,7 +190,7 @@ jobs:
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' }}
@@ -151,7 +211,10 @@ jobs:
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
steps:
- name: Checkout repository
@@ -185,7 +248,7 @@ jobs:
./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
@@ -193,7 +256,7 @@ jobs:
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' }}