-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdagger-test.cue
More file actions
87 lines (79 loc) · 3.18 KB
/
dagger-test.cue
File metadata and controls
87 lines (79 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package todoapp
import (
"dagger.io/dagger"
"universe.dagger.io/bash"
"universe.dagger.io/docker"
)
dagger.#Plan & {
client: {
filesystem: {
"./": read: {
contents: dagger.#FS
exclude: [".idea"]
}
},
network: {
"unix:///var/run/docker.sock": {
connect: dagger.#Socket
}
}
}
actions: {
deps: {
mainContainer: docker.#Build & {
steps: [
docker.#Pull & {
source: "mcr.microsoft.com/dotnet/sdk:6.0"
},
bash.#Run & {
workdir: "/"
script: contents: #"""
apt-get update
DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends docker-ce-cli
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose
"""#
},
docker.#Copy & {
contents: client.filesystem."./".read.contents
dest: "/src"
},
bash.#Run & {
workdir: "/src"
script: contents: #"""
dotnet restore
"""#
},
]
}
}
unitTest: bash.#Run & {
input: deps.mainContainer.output
workdir: "/src"
script: contents: #"""
dotnet test --no-restore NaviAuthUnitTest/NaviAuthUnitTest.csproj
"""#
}
integrationTest: bash.#Run & {
input: deps.mainContainer.output
mounts: docker: {
contents: client.network."unix:///var/run/docker.sock".connect
dest: "/var/run/docker.sock"
}
workdir: "/src"
script: contents: #"""
docker-compose -f NaviAuthIntegrationTest/docker-compose.yml up -d && sleep 5
dotnet test --no-restore NaviAuthIntegrationTest/NaviAuthIntegrationTest.csproj
docker-compose -f NaviAuthIntegrationTest/docker-compose.yml down
"""#
}
test: {
unitTestAction: unitTest
integrationTestAction: integrationTest
}
}
}