Skip to content

Commit bdee159

Browse files
committed
hello world CI tests
1 parent 0d645ae commit bdee159

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1703
-228
lines changed

Diff for: .github/workflows/test-samples.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test .NET Code Samples
2+
3+
on:
4+
pull_request:
5+
branches: ["release/3.*"]
6+
7+
jobs:
8+
Run-Tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout actions
12+
uses: actions/checkout@v3
13+
14+
- name: Start Docker test system
15+
run: docker compose --profile prod up --abort-on-container-exit
16+
17+
# Destroy any remaining containers
18+
- name: Cleanup
19+
run: docker stop $(docker ps -a -q)
20+
21+
#- name: Notify slack
22+
# uses: 8398a7/action-slack@v3
23+
# with:
24+
# status: ${{ job.status }}
25+
# author_name: ":octocat: .NET SDK Automation Test"
26+
# text: "https://tenor.com/en-GB/view/spanish-inquisition-surprise-monty-python-nobody-expects-it-laugh-gif-4970776"
27+
# env:
28+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ local.config
2121
*.lock.json
2222
Couchbase.snk
2323
*.nupkg
24-
24+
*.out
25+
*.vscode

Diff for: Dockerfile

+11-23
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
11
FROM mcr.microsoft.com/dotnet/sdk:6.0
22

3-
LABEL org.opencontainers.image.authors="Hakim Cassimally <hakim.cassimally@couchbase.com>"
3+
LABEL org.opencontainers.image.authors="Tom Rosewell <tom.rosewell@couchbase.com>"
44

5-
RUN apt-get update -y \
6-
&& \
7-
apt-get install -y \
8-
curl vim git
9-
10-
# edit these variables as required
11-
ENV PRE_RELEASE_VERSION 3.2.8-pre
12-
ENV PRE_RELEASE_BUILD r5705
13-
ENV PRE_RELEASE_SOURCE http://sdk.jenkins.couchbase.com/job/dotnet/job/sdk/job/couchbase-net-client-scripted-build-pipeline/lastSuccessfulBuild/artifact/couchbase-net-client-${PRE_RELEASE_VERSION}-${PRE_RELEASE_BUILD}.zip
5+
COPY . /dotnet-docs-repo
6+
WORKDIR /dotnet-docs-repo/tests
147

15-
RUN mkdir -p /app/nuget-sources/
16-
WORKDIR /app/nuget-sources/
17-
RUN curl -O ${PRE_RELEASE_SOURCE}
18-
RUN dotnet nuget add source /app/nuget-sources/
8+
RUN apt-get update -y && \
9+
apt-get install -y \
10+
jq \
11+
curl \
12+
npm
1913

20-
WORKDIR /app
21-
RUN dotnet new console
22-
RUN dotnet add package CouchbaseNetClient -v ${PRE_RELEASE_VERSION}
14+
RUN npm install -g bats
2315

2416
RUN dotnet tool install -g dotnet-script
25-
RUN export PATH="$PATH:/root/.dotnet/tools"
26-
27-
# RUN git clone https://github.com/couchbase/docs-sdk-dotnet.git
28-
# NB: instead we will mount working directory in docker-compose.yml
17+
ENV PATH="$PATH:/root/.dotnet/tools"
2918

30-
ENTRYPOINT ["/bin/bash", "-l", "-c"]
31-
CMD ["/bin/bash"]
19+
ENTRYPOINT [ "./wait-for-couchbase.sh", "1" ]

Diff for: docker-compose.yml

+33-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
11
version: "3.9"
22

3-
# USAGE: docker-compose run cb-dotnet-sdk bash
4-
53
services:
6-
cb-dotnet-sdk:
7-
build: .
8-
depends_on:
9-
- db
10-
container_name: cb-dotnet-sdk
11-
entrypoint: [ "/bin/bash", "-l", "-c" ]
12-
volumes:
13-
- .:/app/docs-sdk-dotnet
14-
15-
db:
16-
image: build-docker.couchbase.com:443/couchbase/server-internal:7.1.0-2549
4+
# Docker uses services names as DNS records.
5+
# Calling the db container this means the
6+
# connection strings in the samples work but,
7+
# still look like placeholders.
8+
your-ip:
9+
image: couchbase/server-sandbox:7.1.1
1710
ports:
1811
- "8091-8095:8091-8095"
12+
- "9102:9102"
1913
- "11210:11210"
20-
expose: # expose ports 8091 & 8094 to other containers (mainly for backend)
14+
expose:
2115
- "8091"
22-
- "8092"
23-
- "8093"
2416
- "8094"
25-
- "8095"
26-
- "11210"
27-
container_name: couchbase-db
17+
container_name: Couchbase-7.1.1
18+
profiles:
19+
- prod
20+
- local
21+
22+
# The GH Action uses this profile to run tests.
23+
dotnet-sdk-repo:
24+
build: .
25+
depends_on:
26+
- your-ip
27+
container_name: dotnet-sdk
28+
profiles:
29+
- prod
30+
31+
# This profile is for local use creating tests.
32+
local-dotnet-sdk-repo:
33+
build:
34+
dockerfile: local-tests.Dockerfile
35+
depends_on:
36+
- your-ip
37+
container_name: dotnet-sdk-local
38+
volumes:
39+
- .:/app
40+
profiles:
41+
- local

Diff for: local-tests.Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:6.0
2+
3+
LABEL org.opencontainers.image.authors="Tom Rosewell <tom.rosewell@couchbase.com>"
4+
5+
WORKDIR /app/tests
6+
7+
RUN apt-get update && \
8+
apt-get install -y \
9+
jq \
10+
curl \
11+
npm
12+
13+
RUN npm install -g bats
14+
15+
RUN dotnet tool install -g dotnet-script
16+
ENV PATH="$PATH:/root/.dotnet/tools"
17+
18+
ENTRYPOINT [ "./wait-for-couchbase.sh" ]

Diff for: modules/concept-docs/examples/Collections.csx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class CollectionsExample
1919
public async Task ExampleAsync()
2020
{
2121
var cluster = await Cluster.ConnectAsync(
22-
"couchbase://localhost",
22+
"couchbase://your-ip",
2323
"Administrator", "password");
2424

2525
var bucket = await cluster.BucketAsync("travel-sample");

Diff for: modules/devguide/examples/dotnet/appsettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"couchbase": {
3-
"connectionString": "couchbase://localhost",
3+
"connectionString": "couchbase://your-ip",
44
"username": "Administrator",
55
"password": "password"
66
}

Diff for: modules/hello-world/examples/.vscode/launch.json

-27
This file was deleted.

Diff for: modules/hello-world/examples/.vscode/tasks.json

-42
This file was deleted.

0 commit comments

Comments
 (0)