Skip to content

Commit

Permalink
test: setup environment for running integration tests on CI and on Gi…
Browse files Browse the repository at this point in the history
…tpod #35
  • Loading branch information
TillaTheHun0 committed Jun 13, 2023
1 parent 1eaa5c5 commit 772e364
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 8 deletions.
50 changes: 47 additions & 3 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ on:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
deno-version: [1.x]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: 🦕 Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}

- name: ⚡ Run Tests
run: |
deno task test
env:
CI: true

test-native-integration-self-hosted:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -31,15 +51,39 @@ jobs:
with:
mongodb-version: ${{ matrix.mongodb-version }}

- name: ⚡ Run Tests
- name: ⚡ Run Native Integration Tests
run: |
deno task test
deno task test:integration-native
env:
CI: true
MONGO_URL: mongodb://127.0.0.1:27017

test-native-integration-atlas:
# Skip for now until the integration suite is done
if: false
runs-on: ubuntu-latest
strategy:
matrix:
deno-version: [1.x]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: 🦕 Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}

- name: ⚡ Run Native Integration Tests (Atlas 🧭)
run: |
deno task test:integration-native
env:
CI: true
MONGO_URL: ${{ secrets.INTEGRATION_ATLAS_MONGO_URL }}

publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: [test]
needs: [test, test-native-integration-self-hosted, test-native-integration-atlas]
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
Expand Down
4 changes: 3 additions & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ tasks:

- name: Setup Git Hooks
init: git config core.hooksPath .hooks
command: deno task test
command: |
export MONGO_URL=mongodb://127.0.0.1:27017
deno task test
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { suite } from './test/suite.ts'
Deno.test({
name: 'Mongo Adapter Test Suite - NativeClient',
fn: async (t) => {
const client = new NativeClient({
url: Deno.env.get('MONGO_URL') || 'mongodb://127.0.0.1:27017',
})
const url = Deno.env.get('MONGO_URL')
if (!url) {
throw new Error('MongoDB connection string is required at MONGO_URL')
}

const client = new NativeClient({ url })
await suite(t)(client, { shouldBaseLine: true })
},
/**
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"tasks": {
"cache": "deno cache --lock=deno.lock --lock-write deps.ts dev_deps.ts",
"test": "deno lint && deno fmt --check && deno test -A --unstable --no-check",
"test": "deno lint && deno fmt --check && deno test -A --unstable",
"test:integration-native": "deno test -A --unstable adapter.native.integration.test.ts",
"test:suite": "deno test --allow-net --allow-env --no-check --no-lock --import-map=https://raw.githubusercontent.com/hyper63/hyper/hyper-test%40v2.1.4/packages/test/import_map.json https://raw.githubusercontent.com/hyper63/hyper/hyper-test%40v2.1.4/packages/test/mod.js",
"test:harness": "deno run --unstable --no-check --no-lock -A ./test/hyper.js"
},
Expand Down

0 comments on commit 772e364

Please sign in to comment.