From 64b21d41dcc951b85379b261c93edaa7928854ad Mon Sep 17 00:00:00 2001 From: Gavin Inglis Date: Wed, 27 Sep 2023 15:34:28 -0700 Subject: [PATCH] ci: add e2e test step for windows Adds a workflow step to run e2e tests on the Windows runner. There are TODOs included to be addressed before a merge with the main branch. For now, this will live in the windev branch to enable CI there. Signed-off-by: Gavin Inglis --- .github/workflows/ci.yaml | 93 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5dd29fc90..09121eb58 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,14 +4,16 @@ name: CI on: push: branches: - - main + # TODO: revert to main on merge of windev branch with main + - windev paths-ignore: - '**.md' - 'contrib/**' - '.github/CODEOWNERS' pull_request: branches: - - main + # TODO: revert to main on merge of windev branch with main + - windev paths-ignore: - '**.md' - 'contrib/**' @@ -26,9 +28,19 @@ concurrency: jobs: gen-code-no-diff: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + [ + [self-hosted, macos, amd64, 13, test], + [self-hosted, windows, amd64, test], + ] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + submodules: recursive - uses: actions/setup-go@v4 with: go-version-file: go.mod @@ -36,9 +48,19 @@ jobs: - run: make gen-code - run: git diff --exit-code unit-tests: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + [ + [self-hosted, macos, amd64, 13, test], + [self-hosted, windows, amd64, test], + ] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + submodules: recursive - uses: actions/setup-go@v4 with: # Since this repository is not meant to be used as a library, @@ -94,6 +116,7 @@ jobs: cache: true - run: make check-licenses e2e-tests: + if: github.event.name == 'TODO skipping now to expedite windows ci' strategy: fail-fast: false matrix: @@ -111,7 +134,7 @@ jobs: # We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail. fetch-depth: 0 persist-credentials: false - submodules: true + submodules: recursive - name: Set output variables id: vars run: | @@ -149,6 +172,66 @@ jobs: git clean -f -d REGISTRY=${{ steps.vars.outputs.has_creds == true && env.REGISTRY || '' }} make test-e2e shell: zsh {0} + windows-e2e-tests: + strategy: + fail-fast: false + matrix: + os: + [ + [self-hosted, windows, amd64, test], + ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + # We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail. + fetch-depth: 0 + persist-credentials: false + submodules: true + # - name: Set output variables + # id: vars + # run: | + # has_creds=${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }} + # echo "has_creds=$has_creds" >> $GITHUB_OUTPUT + # - name: configure aws credentials + # uses: aws-actions/configure-aws-credentials@v4 + # if: steps.vars.outputs.has_creds == true + # with: + # role-to-assume: ${{ secrets.ROLE }} + # role-session-name: credhelper-test + # aws-region: ${{ secrets.REGION }} + - name: Run some WSL commands + which wsl + wsl --list --verbose + + Invoke-Expression "& 'C:\Program Files\WSL\wsl.exe' --list --verbose" + + - name: Clean up previous files + run: | + make clean + cd deps/finch-core && make clean + - name: Build project + run: | + make + - name: Run e2e tests + run: | + # Wrap wsl as alias to pre-release WSL + $wslwrapper = @' + $argstr=[string]$Args + powershell "&'C:\Program Files\WSL\wsl.exe' '$argstr'" -RunAsAdmin + '@ + + # Write PowerShell 7 script to file + $wslwrapper | Out-File C:\wsl-wrapper.ps1 + + C:\wsl-wrapper.ps1 --list --verbose + + # Set-Alias -Name wsl -Value C:\wsl-wrapper.ps1 + # wsl --list --verbose + + # $env:Path = "C:\Program Files\WSL\;" + $env:Path + # which wsl + # wsl --list --verbose mdlint: runs-on: ubuntu-latest steps: