Skip to content

Commit 53841ee

Browse files
committed
added integration tests
1 parent 49cc043 commit 53841ee

File tree

12 files changed

+1211
-0
lines changed

12 files changed

+1211
-0
lines changed

.github/workflows/test_release.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Test & Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
gitTag:
7+
description: 'Tag version (e. 1.1.6)'
8+
required: true
9+
10+
env:
11+
CI_USER: ${{ secrets.CI_USER }}
12+
13+
jobs:
14+
15+
build:
16+
name: Build
17+
runs-on: ubuntu-latest
18+
steps:
19+
20+
- name: Set up Go 1.x
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: ^1.13
24+
id: go
25+
26+
- name: Check out code into the Go module directory
27+
uses: actions/checkout@v2
28+
29+
- name: Get dependencies
30+
run: |
31+
go mod tidy
32+
go mod download
33+
34+
- name: Test
35+
run: go test -v .
36+
37+
- name: Release
38+
run: |
39+
export VERSION = ${{ github.event.inputs.gitTag }}
40+
for tag in $(git tag -l v[0-9].[0-9].[0-9]*)
41+
do
42+
if [[ $tag == v$VERSION ]]; then
43+
echo "version $VERSION already exists: please ensure that you properly increment the version in the VERSION file as per semantic versioning standards"
44+
exit 1
45+
fi
46+
done
47+
48+
git config --global url."https://${{ secrets.CTO_PAT }}@github.com/cto-ai".insteadOf "https://github.com/cto-ai"
49+
cat ~/.gitconfig
50+
git config --global user.email "[email protected]"
51+
git config --global user.name "$CI_USER"
52+
git tag -a v$VERSION -m "Gitlab CI/CD releasing version $VERSION" || exit 1
53+
git push https://${{ secrets.CTO_PAT }}@github.com/cto-ai/slackauth.git v$VERSION || exit 1

.github/workflows/test_tag.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Test Tag
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
gitTag:
6+
description: 'Tag version (e. 1.1.6)'
7+
required: true
8+
9+
jobs:
10+
- name: Docker Build
11+
run: |
12+
docker build --build-arg SDK_TAG=${{github.event.inputs.gitTag}} -f sdk-integration-testing/Dockerfile sdk-integration-testing

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313

1414
# Dependency directories (remove the comment below to include it)
1515
# vendor/
16+
17+
.idea/

sdk-integration-testing/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM registry.cto.ai/official_images/base:latest as dep
2+
FROM golang:1.16 as mock-build
3+
4+
ARG SDK_TAG=v2.2.3
5+
6+
COPY --from=dep /bin/sdk-daemon /bin/.
7+
COPY --from=dep /bin/interaction-server /bin/.
8+
9+
RUN ls /bin
10+
11+
12+
RUN go get github.com/cto-ai/sdk-go/v2@${SDK_TAG}
13+
14+
WORKDIR /build
15+
16+
ADD . .
17+
18+
RUN go build -o /bin/mock-api -i mock-api.go
19+
20+
RUN go build -o /bin/verify -i sdk-compatibility-testing/verify-exemplar.go
21+
22+
RUN go build -o testsdk -i sdk-compatibility-testing/golang/main.go
23+
24+
CMD /bin/verify /build/testsdk

sdk-integration-testing/go.mod

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module sdk-integration-testing
2+
3+
go 1.17
4+
5+
require (
6+
github.com/cto-ai/sdk-go v1.0.0-beta.1
7+
github.com/go-test/deep v1.0.8
8+
github.com/gorilla/mux v1.8.0
9+
)

sdk-integration-testing/go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
github.com/cto-ai/sdk-go v1.0.0-beta.1 h1:7pL5Vhx+rg5xJBdPtOYt0I6ROKpSW+v46f9fecz1omg=
2+
github.com/cto-ai/sdk-go v1.0.0-beta.1/go.mod h1:umIduIMaxXirQxEdnDGyTmFPmgflS/oMMGb8vqnT7vw=
3+
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
4+
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
5+
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
6+
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=

0 commit comments

Comments
 (0)