E2E #1269
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: E2E | |
on: | |
# Enable manually triggering this workflow via the API or web UI | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
# At 06:00 AM UTC from Monday through Friday | |
- cron: '0 6 * * 1-5' | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
go: [stable, tip] | |
platform: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.x | |
- name: Install Go tip | |
if: matrix.go == 'tip' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release download ${{ matrix.platform }} --repo grafana/gotip --pattern 'go.zip' | |
unzip go.zip -d $HOME/sdk | |
echo "GOROOT=$HOME/sdk/gotip" >> "$GITHUB_ENV" | |
echo "GOPATH=$HOME/go" >> "$GITHUB_ENV" | |
echo "$HOME/go/bin" >> "$GITHUB_PATH" | |
echo "$HOME/sdk/gotip/bin" >> "$GITHUB_PATH" | |
- name: Install chromium | |
# This is only needed on arm images, chromium comes preinstalled on amd64 runner images. | |
if: contains(matrix.platform, 'arm') | |
run: | | |
sudo apt update && sudo apt install chromium-browser | |
chromium --version | |
- name: Build k6 | |
run: | | |
which go | |
go version | |
go build . | |
./k6 version | |
- name: Run E2E tests | |
run: | | |
set -x | |
if [ "$RUNNER_OS" == "Linux" ] && [ "$RUNNER_ARCH" == "X64" ]; then | |
export K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome | |
fi | |
export K6_BROWSER_HEADLESS=true | |
for f in examples/browser/*.js; do | |
if [ "$f" == "examples/browser/hosts.js" ] && [ "$RUNNER_OS" == "Windows" ]; then | |
echo "skipping $f on Windows" | |
continue | |
fi | |
./k6 run -q "$f" | |
done | |
- name: Check screenshot | |
# TODO: Do something more sophisticated? | |
run: test -s screenshot.png |