Skip to content

Commit

Permalink
Actually run integration tests with the corresponding runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Feb 9, 2025
1 parent 9b14e0e commit ebec6aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ jobs:
version: '22.x'
- name: 'node'
version: '23.x'
- name: 'deno'
version: 'v1.x'
- name: 'deno'
version: 'v2.x'
- name: 'bun'
# version: '1.x' # Version selectors do not work https://github.com/oven-sh/setup-bun/issues/37
version: '1.2.2'
shlink-version: ['4.4', '4.3', '4.2', '4.1', '4.0', '3.7', '3.6', '3.5.4']
shlink-api-version: ['3']
continue-on-error: ${{ matrix.runtime.name == 'deno' }}
steps:
- uses: actions/checkout@v4
- if: ${{ matrix.runtime.name == 'node' }}
Expand All @@ -46,4 +45,4 @@ jobs:
with:
bun-version: ${{ matrix.runtime.version }}
- run: npm ci
- run: SHLINK_VERSION=${{ matrix.shlink-version }} SHLINK_API_VERSION=${{ matrix.shlink-api-version }} npm run test:integration
- run: SHLINK_VERSION=${{ matrix.shlink-version }} SHLINK_API_VERSION=${{ matrix.shlink-api-version }} RUNTIME=${{ matrix.runtime.name }} sh ./test/run-integration-tests.sh
11 changes: 9 additions & 2 deletions test/run-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if [ -z "${SHLINK_VERSION}" ]; then
exit 1
fi

RUNTIME=${RUNTIME:='node'}
export SHLINK_VERSION=${SHLINK_VERSION}
export SHLINK_API_VERSION=${SHLINK_API_VERSION:='3'}
PORT="8765"
Expand All @@ -13,8 +14,14 @@ CONTAINER=$(docker run --rm -d -p ${PORT}:8080 -e DEFAULT_DOMAIN=localhost:${POR
sleep 2 # Let's give the server a couple of seconds to start
export SHLINK_API_KEY=$(docker exec ${CONTAINER} shlink api-key:generate | grep "Generated API key" | sed 's/.*Generated\ API\ key\:\ \"\(.*\)\".*/\1/')

### TODO Run tests here
npm run test -- --config vitest-integration.config.ts
if [ "${RUNTIME}" = "node" ]; then
npm run test -- --config vitest-integration.config.ts
elif [ "${RUNTIME}" = "deno" ]; then
deno run --allow-read=$PWD --allow-sys ./node_modules/.bin/vitest -- run --config vitest-integration.config.ts
elif [ "${RUNTIME}" = "bun" ]; then
bun run test -- --config vitest-integration.config.ts
fi

TESTS_EXIT_CODE=$?

docker stop ${CONTAINER}
Expand Down

0 comments on commit ebec6aa

Please sign in to comment.