diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2c6749430..0cf4ea8ed 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -19,17 +19,19 @@ jobs: strategy: matrix: go: [stable, tip] - platform: [ubuntu-latest-8-cores, windows-latest, macos-latest] - runs-on: ubuntu-latest-8-cores + platform: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.platform }} steps: - name: Checkout code + if: matrix.go != 'tip' || matrix.platform != 'windows-latest' uses: actions/checkout@v2 - name: Install Go + if: matrix.go != 'tip' || matrix.platform != 'windows-latest' uses: actions/setup-go@v2 with: go-version: 1.x - name: Install Go tip - if: matrix.go == 'tip' + if: matrix.go == 'tip' && matrix.platform != 'windows-latest' run: | go install golang.org/dl/gotip@latest gotip download @@ -38,8 +40,10 @@ jobs: echo "$HOME/go/bin" >> "$GITHUB_PATH" echo "$HOME/sdk/gotip/bin" >> "$GITHUB_PATH" - name: Install xk6 + if: matrix.go != 'tip' || matrix.platform != 'windows-latest' run: go install go.k6.io/xk6/cmd/xk6@master - name: Build extension + if: matrix.go != 'tip' || matrix.platform != 'windows-latest' run: | which go go version @@ -48,29 +52,22 @@ jobs: --output ./k6extension \ --with github.com/grafana/xk6-browser=. ./k6extension version - - name: Install Chrome dependencies - if: runner.os == 'Linux' - run: "${GITHUB_WORKSPACE}/.github/bin/install_chrome_deps_linux.sh" - - name: Setup Chrome - uses: browser-actions/setup-chrome@latest - with: - chrome-version: stable - - name: Chrome version - if: runner.os != 'Windows' - run: chrome --version - - name: Chrome version - if: runner.os == 'Windows' - shell: pwsh - # chrome --version doesn't work on Windows :-/ - # See https://bugs.chromium.org/p/chromium/issues/detail?id=158372 - run: (get-command chrome.exe).Version - name: Run E2E tests + if: matrix.go != 'tip' || matrix.platform != 'windows-latest' run: | set -x + if [ "$RUNNER_OS" == "Linux" ]; then + export K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome + fi export K6_BROWSER_HEADLESS=true for f in examples/*.js; do + if [ "$f" == "examples/hosts.js" ] && [ "$RUNNER_OS" == "Windows" ]; then + echo "skipping $f on Windows" + continue + fi ./k6extension run "$f" done - name: Check screenshot + if: matrix.go != 'tip' || matrix.platform != 'windows-latest' # TODO: Do something more sophisticated? run: test -s screenshot.png diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01d91ce3c..11053ebf4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: go-version: [1.19.x] - platform: [ubuntu-latest-8-cores] + platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: - name: Checkout code @@ -46,11 +46,10 @@ jobs: args[1]="1" export GOMAXPROCS=1 fi - export K6_BROWSER_HEADLESS=true - go test "${args[@]}" -timeout 5m ./... + K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome K6_BROWSER_HEADLESS=true go test "${args[@]}" -timeout 5m ./... test-tip: - runs-on: ubuntu-latest-8-cores + runs-on: ubuntu-latest continue-on-error: true steps: - name: Checkout code @@ -75,15 +74,14 @@ jobs: go version export GOMAXPROCS=2 args=("-p" "2" "-race") - export K6_BROWSER_HEADLESS=true - go test "${args[@]}" -timeout 5m ./... + K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome K6_BROWSER_HEADLESS=true go test "${args[@]}" -timeout 5m ./... test-current-cov: strategy: fail-fast: false matrix: go-version: [1.19.x] - platform: [ubuntu-latest-8-cores] + platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: - name: Checkout code @@ -104,7 +102,6 @@ jobs: args[1]="1" export GOMAXPROCS=1 fi - export K6_BROWSER_HEADLESS=true echo "mode: set" > coverage.txt for pkg in $(go list ./... | grep -v vendor); do list=$(go list -test -f '{{ join .Deps "\n"}}' $pkg | grep github.com/grafana/xk6-browser | grep -v vendor || true) @@ -112,7 +109,7 @@ jobs: list=$(echo "$list" | cut -f1 -d ' ' | sort -u | paste -sd, -) fi - go test "${args[@]}" -timeout 5m --coverpkg="$list" -coverprofile=$(echo $pkg | tr / -).coverage $pkg + K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome K6_BROWSER_HEADLESS=true go test "${args[@]}" -timeout 5m --coverpkg="$list" -coverprofile=$(echo $pkg | tr / -).coverage $pkg done grep -h -v "^mode:" *.coverage >> coverage.txt rm -f *.coverage @@ -129,7 +126,7 @@ jobs: fail-fast: false matrix: go-version: [1.19.x] - platform: [ubuntu-latest-8-cores] + platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: - name: Checkout code @@ -156,5 +153,4 @@ jobs: go get go.k6.io/k6@master go mod tidy cat go.mod | grep go.k6.io/k6 - export K6_BROWSER_HEADLESS=true - go test "${args[@]}" -timeout 5m ./... + K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome K6_BROWSER_HEADLESS=true go test "${args[@]}" -timeout 5m ./...