Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build-with-xk6:
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
Expand All @@ -36,5 +36,6 @@ jobs:
shell: bash

- name: Test
if: runner.os == 'Linux'
run: make container-test
shell: bash
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
k6
helpers/clidriver
helpers/*.tar.gz
helpers/*.zip

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.a
*.lib
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endef
all: test build example

xk6${ext}:
xk6${ext} -V
xk6${ext} -V || (echo "Please install xk6 or make sure it is available in your PATH"; exit 1)

test: setup-db2 *.go testdata/*.js
go test -count 1 ./...
Expand All @@ -51,9 +51,7 @@ setup-container:
$(call check_timeout, until docker exec db2test su - -c "db2 connect to SAMPLE" db2inst1)

setup-db2:
curl -L https://raw.githubusercontent.com/ibmdb/go_ibm_db/refs/heads/master/installer/setup.go -o setup.go
-go run setup.go
rm -f setup.go
go run ./helpers/db2_cli_setup.go

k6: xk6${ext} setup-db2 *.go go.mod go.sum
xk6${ext} build -v --with github.com/grafana/xk6-sql@latest --with github.com/oleiade/xk6-encoding@latest --with github.com/iambaim/xk6-sql-driver-db2=.
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ export default function () {
}
```

## Building

The included `Makefile` is the preferred way to build this extension. Just execute `make k6`.

### Manual building step

1. Download and extract DB2 CLI driver (available here: https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli).
2. Install `xk6`:
```
go install go.k6.io/xk6@latest
```
3. Set the environment variable, for example in Linux:
```
export IBM_DB_HOME=<IBM DB2 CLI driver extracted path>
export CGO_CFLAGS=-I${IBM_DB_HOME}/include
export CGO_LDFLAGS=-L${IBM_DB_HOME}/lib
export LD_LIBRARY_PATH=${IBM_DB_HOME}/lib
export XK6_RACE_DETECTOR=1
export CGO_ENABLED=1
```
4. Build this extension (we need encoding for query result texts):
```
xk6 build --with github.com/grafana/xk6-sql@latest --with github.com/oleiade/xk6-encoding@latest --with github.com/iambaim/xk6-sql-driver-db2=.
```

## Usage

Check the [xk6-sql documentation](https://github.com/grafana/xk6-sql) on how to use this database driver.
Loading
Loading