Bypass environment variables for license generation on Windows (#1377) #3645
This file contains hidden or 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: Integration tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - "*" | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| env: | |
| kind_version: 0.30.0 # datasource=github-releases depName=kubernetes-sigs/kind | |
| kubernetes_version: 1.34.0 # datasource=docker depName=kindest/node | |
| jobs: | |
| test-integration: | |
| name: integration tests on ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| arch: x64 | |
| - os: macos-14 | |
| arch: arm64 | |
| - os: windows-2022 | |
| arch: x64 | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 60 | |
| env: | |
| DO_NOT_TRACK: "1" | |
| ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron | |
| ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder | |
| ELECTRON_HEADERS_CACHE: ${{ github.workspace }}/.cache/electron-headers | |
| PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/playwright | |
| TURBOREPO_CACHE: ${{ github.workspace }}/.turbo | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install bash coreutils python-setuptools | |
| - name: Add coreutils to PATH (macOS) | |
| if: runner.os == 'macOS' | |
| run: echo "/usr/local/opt/coreutils/libexec/gnubin" >> $GITHUB_PATH | |
| - name: Install dependencies (Windows) | |
| id: install-deps-windows | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: timeout 300 choco install yq --yes --no-progress | |
| continue-on-error: true | |
| - name: Install dependencies (Windows) (retry) | |
| if: runner.os == 'Windows' && steps.install-deps-windows.outcome == 'failure' | |
| shell: bash | |
| run: timeout 300 choco install yq --yes --no-progress | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| package-manager-cache: false | |
| - name: Setup pnpm | |
| run: corepack enable | |
| - name: Get pnpm cache directory | |
| shell: bash | |
| run: echo "pnpm_cache_dir=$(pnpm store path)" >> ${GITHUB_ENV} | |
| - name: Use pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.pnpm_cache_dir }} | |
| key: ${{ matrix.os }}-${{ matrix.arch }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ matrix.os }}-${{ matrix.arch }}-node- | |
| - name: Get Electron version | |
| shell: bash | |
| run: echo "electron_version=$(yq -r .importers.freelens.devDependencies.electron.version pnpm-lock.yaml | sed 's/(.*)//')" >> $GITHUB_ENV | |
| - name: Get Electron Builder version | |
| shell: bash | |
| run: echo "electron_builder_version=$(yq -r .importers.freelens.devDependencies.electron-builder.version pnpm-lock.yaml | sed 's/(.*)//')" >> $GITHUB_ENV | |
| - name: Get Playwright version | |
| shell: bash | |
| run: echo "playwright_version=$(yq -r .importers.freelens.devDependencies.playwright.version pnpm-lock.yaml | sed 's/(.*)//')" >> $GITHUB_ENV | |
| - name: Use Electron cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.ELECTRON_CACHE }} | |
| key: ${{ matrix.os }}-${{ matrix.arch }}-electron-${{ env.electron_version }} | |
| restore-keys: | | |
| ${{ matrix.os }}-${{ matrix.arch }}-electron- | |
| - name: Use Electron Builder cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.ELECTRON_BUILDER_CACHE }} | |
| key: ${{ matrix.os }}-${{ matrix.arch }}-electron-builder-${{ env.electron_builder_version }} | |
| restore-keys: | | |
| ${{ matrix.os }}-${{ matrix.arch }}-electron-builder- | |
| - name: Use Electron headers cache | |
| id: electron-headers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.ELECTRON_HEADERS_CACHE }} | |
| key: electron-headers-${{ env.electron_version }} | |
| - name: Use Playwright cache | |
| id: playwright-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} | |
| key: ${{ matrix.os }}-${{ matrix.arch }}-playwright-${{ env.playwright_version }} | |
| restore-keys: | | |
| ${{ matrix.os }}-${{ matrix.arch }}-playwright- | |
| - name: Use Turborepo cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.TURBOREPO_CACHE }} | |
| key: ${{ matrix.os }}-${{ matrix.arch }}-turborepo-${{ hashFiles('**/package.json', '**/pnpm-lock.yaml', 'turbo.json') }} | |
| restore-keys: | | |
| ${{ matrix.os }}-${{ matrix.arch }}-turborepo- | |
| - name: Start KinD cluster (Linux) | |
| if: runner.os == 'Linux' | |
| uses: helm/kind-action@v1 | |
| with: | |
| cluster_name: freelens | |
| version: v${{ env.kind_version }} | |
| node_image: kindest/node:v${{ env.kubernetes_version }} | |
| wait: 5m | |
| - name: Install pnpm dependencies | |
| id: install-pnpm | |
| shell: bash | |
| run: timeout 300 pnpm install --color=always --prefer-offline --frozen-lockfile | |
| env: | |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" | |
| continue-on-error: true | |
| - name: Install pnpm dependencies (retry) | |
| if: steps.install-pnpm.outcome == 'failure' | |
| shell: bash | |
| run: timeout 300 pnpm install --color=always --prefer-offline --frozen-lockfile | |
| env: | |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" | |
| - name: Put $HOME in env (Windows) | |
| if: runner.os == 'windows' | |
| run: echo "HOME=$HOME" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Install Electron headers | |
| if: steps.electron-headers.outputs.cache-hit != 'true' | |
| shell: bash | |
| run: | | |
| set -eo pipefail | |
| mkdir -p $ELECTRON_HEADERS_CACHE | |
| curl -sSfL https://www.electronjs.org/headers/v$electron_version/node-v$electron_version-headers.tar.gz -o $ELECTRON_HEADERS_CACHE/node-v$electron_version-headers.tar.gz | |
| - name: Install Playwright with dependencies | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: pnpx playwright install --with-deps | |
| - name: Install Playwright's dependencies | |
| if: steps.playwright-cache.outputs.cache-hit == 'true' | |
| run: pnpx playwright install-deps | |
| - name: Build packages (macOS x64, Linux arm64) | |
| if: runner.os == 'macOS' && matrix.arch == 'x64' || runner.os == 'Linux' && matrix.arch == 'arm64' | |
| run: pnpm --color=always --stream build | |
| env: | |
| DOWNLOAD_ALL_ARCHITECTURES: "true" | |
| - name: Build packages (macOS arm64, Linux x64, Windows) | |
| if: runner.os == 'macOS' && matrix.arch == 'arm64' || runner.os == 'Linux' && matrix.arch == 'x64' || runner.os == 'Windows' | |
| run: pnpm --color=always --stream build | |
| - name: Rebuild native packages for Electron | |
| run: pnpm --color=always electron-rebuild -a ${{ matrix.arch }} | |
| env: | |
| npm_package_config_node_gyp_tarball: ${{ env.ELECTRON_HEADERS_CACHE }}/node-v${{ env.electron_version }}-headers.tar.gz | |
| - name: Build extra resources | |
| id: build-resources | |
| run: pnpm --color=always build:resources | |
| continue-on-error: true | |
| - name: Build extra resources (retry) | |
| id: build-resources-2 | |
| if: steps.build-resources.outcome == 'failure' | |
| run: pnpm --color=always build:resources | |
| continue-on-error: true | |
| - name: Build extra resources (retry 2) | |
| if: steps.build-resources-2.outcome == 'failure' | |
| run: pnpm --color=always build:resources | |
| - name: Build Electron app | |
| run: pnpm --color=always build:app:dir --${{ matrix.arch }} | |
| - name: Run integration tests (Linux) | |
| id: integration-tests-linux | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo chown root:root freelens/dist/linux-unpacked/chrome-sandbox | |
| sudo chmod 4755 freelens/dist/linux-unpacked/chrome-sandbox | |
| timeout 600 xvfb-run -a pnpm --color=always test:integration | |
| env: | |
| DEBUG: pw:browser | |
| TEST_KIND_CLUSTER_NAME: freelens | |
| continue-on-error: true | |
| - name: Run integration tests (Linux) (retry) | |
| if: runner.os == 'Linux' && steps.integration-tests-linux.outcome == 'failure' | |
| run: | | |
| sudo chown root:root freelens/dist/linux-unpacked/chrome-sandbox | |
| sudo chmod 4755 freelens/dist/linux-unpacked/chrome-sandbox | |
| timeout 600 xvfb-run -a pnpm --color=always test:integration | |
| env: | |
| DEBUG: pw:browser | |
| - name: Run integration tests (macOS, Windows) | |
| id: integration-tests-macos-windows | |
| if: runner.os != 'Linux' | |
| shell: bash | |
| run: timeout 600 pnpm --color=always test:integration | |
| env: | |
| DEBUG: pw:browser | |
| continue-on-error: true | |
| - name: Run integration tests (macOS, Windows) (retry) | |
| if: runner.os != 'Linux' && steps.integration-tests-macos-windows.outcome == 'failure' | |
| shell: bash | |
| run: timeout 600 pnpm --color=always test:integration | |
| env: | |
| DEBUG: pw:browser |