-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: k6 - Smoke Testing Suite | ||
on: [push] | ||
|
||
jobs: | ||
runner-job: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
quickpizza: | ||
image: ghcr.io/grafana/quickpizza-local:latest | ||
ports: | ||
- 3333:3333 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# cannot use the k6 docker image because it does not allow executing shell commands | ||
- name: Install k6 in Ubuntu | ||
run: | | ||
sudo gpg -k | ||
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69 | ||
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list | ||
sudo apt-get update | ||
sudo apt-get install k6 | ||
# - name: Install ACT missing dependencies | ||
# run: | | ||
# sudo apt-get update | ||
# . sudo apt-get install -y ca-certificates gnupg2 | ||
# sudo apt-get install -y libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 | ||
|
||
- name: Install Chromium | ||
uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: chromium-browser | ||
|
||
#- name: Run k6 foundations tests | ||
# run: ./run-ci-tests.sh -t ./k6/foundations/01.basic.js -u http://localhost:3333 | ||
# uses: grafana/k6-github-action@v1 | ||
# with: | ||
# include: ./k6/browser/01.basic.js | ||
# params: --no-thresholds -e BASE_URL=http://localhost:3333 | ||
# browser: true | ||
- name: Run k6 browser tests | ||
run: ./run-ci-tests.sh -t ./k6/browser/01.basic.js -u http://localhost:3333 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
shopt -s globstar | ||
|
||
while getopts "u:t:" flag; do | ||
case $flag in | ||
u) BASE_URL="$OPTARG" ;; | ||
t) TESTS="$OPTARG" ;; | ||
esac | ||
done | ||
|
||
BASE_URL="${BASE_URL:=http://localhost:3333}" | ||
TESTS="${TESTS:=k6/foundations/*.js}" | ||
|
||
for test in $TESTS; do | ||
#echo $test | ||
# Run without thresholds because some examples will fail | ||
K6_BROWSER_HEADLESS=true K6_BROWSER_ARGS='no-sandbox' k6 run --no-thresholds -e BASE_URL=$BASE_URL "$test" | ||
|
||
# If k6 run command fails, exit with the same status code | ||
if [ $? -ne 0 ]; then | ||
exit $? | ||
fi | ||
done |