Remove the api package #1598
Workflow file for this run
This file contains 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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
# At 06:00 AM UTC from Monday through Friday | |
- cron: '0 6 * * 1-5' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test-prev: | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: [1.19.x] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get the k6 version | |
id: get_k6_version | |
run: | | |
echo "Running tests on '${GITHUB_REF}' with '$(git describe --tags --always --long --dirty)' checked out..." | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
check-latest: true | |
- name: Run tests | |
run: | | |
set -x | |
go version | |
args=("-race") | |
K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome K6_BROWSER_HEADLESS=true go test "${args[@]}" -timeout 5m ./... | |
test-tip: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.x | |
check-latest: true | |
- name: Install Go tip | |
run: | | |
go install golang.org/dl/gotip@latest | |
gotip download | |
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: Run tests | |
run: | | |
set -x | |
which go | |
go version | |
args=("-race") | |
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] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
check-latest: true | |
- name: Run tests with code coverage | |
run: | | |
go version | |
args=("-race") | |
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) | |
if [ -n "$list" ]; then | |
list=$(echo "$list" | cut -f1 -d ' ' | sort -u | paste -sd, -) | |
fi | |
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 | |
- name: Generate coverage HTML report | |
run: go tool cover -html=coverage.txt -o coverage.html | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-coverage-report-${{ matrix.platform }} | |
path: coverage.html | |
test-current-latest-k6: | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: [1.19.x] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
check-latest: true | |
- name: Run tests with latest k6 | |
run: | | |
set -x | |
go version | |
args=("-race") | |
cat go.mod | grep go.k6.io/k6 | |
# Get the latest master version of k6 | |
go get go.k6.io/k6@master | |
go mod tidy | |
cat go.mod | grep go.k6.io/k6 | |
K6_BROWSER_EXECUTABLE_PATH=/usr/bin/google-chrome K6_BROWSER_HEADLESS=true go test "${args[@]}" -timeout 5m ./... |