Skip to content

Commit eedaaf3

Browse files
committed
Try dagger
1 parent 3d0231d commit eedaaf3

File tree

4 files changed

+200
-75
lines changed

4 files changed

+200
-75
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,78 +3,14 @@ name: CI
33
on: [push]
44

55
jobs:
6-
decision-tree:
6+
ci:
7+
strategy:
8+
matrix:
9+
proj: [decision-tree, dijkstra, dug, genetic]
710
runs-on: ubuntu-latest
8-
defaults:
9-
run:
10-
working-directory: decision-tree
1111
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-dotnet@v1
14-
with:
15-
dotnet-version: 7.0.x
16-
- name: Install
17-
run: dotnet tool restore
18-
- name: Build
19-
run: dotnet build
20-
- name: Format
21-
run: dotnet tool run fantomas --check .
22-
- name: Lint
23-
run: dotnet tool run dotnet-fsharplint lint DecisionTree.fsproj
24-
- name: Test
25-
run: dotnet test
26-
27-
dijkstra:
28-
runs-on: ubuntu-latest
29-
defaults:
30-
run:
31-
working-directory: dijkstra
32-
steps:
33-
- uses: actions/checkout@v2
34-
- uses: actions/setup-go@v3
35-
with:
36-
go-version: 1.19
37-
- name: Build
38-
run: go build -v
39-
- name: Format
40-
run: gofmt -d
41-
- name: Test
42-
run: go test -v
43-
44-
dug:
45-
runs-on: ubuntu-latest
46-
defaults:
47-
run:
48-
working-directory: dug
49-
steps:
50-
- uses: actions/checkout@v2
51-
- uses: actions/setup-python@v2
52-
with:
53-
python-version: 3.10.x
54-
- name: Install
55-
run: pip install black mypy pylint -r requirements.txt
56-
- name: Format
57-
run: black --check .
58-
- name: Lint
59-
run: pylint --rcfile=.pylintrc $(git ls-files '*.py') && mypy asmt
60-
- name: Test
61-
run: python -m pytest .
62-
63-
genetic:
64-
runs-on: ubuntu-latest
65-
defaults:
66-
run:
67-
working-directory: genetic
68-
steps:
69-
- uses: actions/checkout@v2
70-
- uses: actions/setup-python@v2
71-
with:
72-
python-version: 3.10.x
73-
- name: Install
74-
run: pip install black mypy pylint -r requirements.txt
75-
- name: Format
76-
run: black --check .
77-
- name: Lint
78-
run: pylint --rcfile=.pylintrc genetic test && mypy genetic test
79-
- name: Test
80-
run: python -m pytest .
12+
- run: curl -L https://dl.dagger.io/dagger-cue/install.sh | sh
13+
working-directory: /usr/local
14+
- uses: actions/checkout@v3
15+
- run: dagger-cue project init && dagger-cue project update
16+
- run: dagger-cue do ${{ matrix.proj }}

ci.cue

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
package plays
2+
3+
import (
4+
"dagger.io/dagger"
5+
"universe.dagger.io/bash"
6+
"universe.dagger.io/docker"
7+
)
8+
9+
dagger.#Plan & {
10+
client: filesystem: {
11+
"decision-tree": read: {
12+
contents: dagger.#FS
13+
exclude: ["bin", "obj"]
14+
}
15+
"dijkstra": read: contents: dagger.#FS
16+
"dug": read: {
17+
contents: dagger.#FS
18+
exclude: [
19+
".mypy_cache",
20+
".pytest_cache",
21+
".streamlit",
22+
"venv",
23+
]
24+
}
25+
"genetic": read: {
26+
contents: dagger.#FS
27+
exclude: [
28+
".mypy_cache",
29+
".pytest_cache",
30+
"venv",
31+
]
32+
}
33+
}
34+
35+
actions: {
36+
decisiontree: {
37+
img: docker.#Build & {
38+
steps: [
39+
docker.#Pull & {
40+
source: "mcr.microsoft.com/dotnet/sdk:7.0"
41+
},
42+
docker.#Set & {
43+
config: workdir: "/app"
44+
},
45+
docker.#Copy & {
46+
contents: client.filesystem."decision-tree".read.contents
47+
dest: "/app"
48+
},
49+
docker.#Run & {
50+
command: {
51+
name: "dotnet"
52+
args: ["restore"]
53+
}
54+
},
55+
docker.#Run & {
56+
command: {
57+
name: "dotnet"
58+
args: ["tool", "restore"]
59+
}
60+
},
61+
]
62+
}
63+
build: bash.#Run & {
64+
input: img.output
65+
script: contents: "dotnet build"
66+
}
67+
fmt: bash.#Run & {
68+
input: img.output
69+
script: contents: "dotnet tool run fantomas --check ."
70+
}
71+
lint: bash.#Run & {
72+
input: img.output
73+
script: contents: "dotnet tool run dotnet-fsharplint lint DecisionTree.fsproj"
74+
}
75+
test: bash.#Run & {
76+
input: img.output
77+
script: contents: "dotnet test"
78+
}
79+
}
80+
81+
dijkstra: {
82+
img: docker.#Build & {
83+
steps: [
84+
docker.#Pull & {
85+
source: "golang:latest"
86+
},
87+
docker.#Set & {
88+
config: workdir: "/app"
89+
},
90+
docker.#Copy & {
91+
contents: client.filesystem."dijkstra".read.contents
92+
dest: "/app"
93+
},
94+
]
95+
}
96+
build: bash.#Run & {
97+
input: img.output
98+
script: contents: "go build -v"
99+
}
100+
fmt: bash.#Run & {
101+
input: img.output
102+
script: contents: "test -z $(gofmt -l .)"
103+
}
104+
test: bash.#Run & {
105+
input: img.output
106+
script: contents: "go test -v"
107+
}
108+
}
109+
110+
dug: {
111+
img: docker.#Build & {
112+
steps: [
113+
docker.#Pull & {
114+
source: "python:3.11"
115+
},
116+
docker.#Set & {
117+
config: workdir: "/app"
118+
},
119+
docker.#Set & {
120+
input: _
121+
config: env: PYTHONPATH: "/app"
122+
},
123+
docker.#Copy & {
124+
contents: client.filesystem."dug".read.contents
125+
dest: "/app"
126+
},
127+
docker.#Run & {
128+
command: {
129+
name: "pip"
130+
args: ["install", "black", "mypy", "pylint", "-r", "requirements.txt"]
131+
}
132+
},
133+
]
134+
}
135+
fmt: bash.#Run & {
136+
input: img.output
137+
script: contents: "black --check ."
138+
}
139+
lint: bash.#Run & {
140+
input: img.output
141+
script: contents: "pylint --rcfile=.pylintrc $(find . -type f -name '*.py') && mypy asmt"
142+
}
143+
test: bash.#Run & {
144+
input: img.output
145+
script: contents: "python -m pytest ."
146+
}
147+
}
148+
149+
genetic: {
150+
img: docker.#Build & {
151+
steps: [
152+
docker.#Pull & {
153+
source: "python:3.11"
154+
},
155+
docker.#Set & {
156+
config: workdir: "/app"
157+
},
158+
docker.#Set & {
159+
input: _
160+
config: env: PYTHONPATH: "/app"
161+
},
162+
docker.#Copy & {
163+
contents: client.filesystem."genetic".read.contents
164+
dest: "/app"
165+
},
166+
docker.#Run & {
167+
command: {
168+
name: "pip"
169+
args: ["install", "black", "mypy", "pylint", "-r", "requirements.txt"]
170+
}
171+
},
172+
]
173+
}
174+
fmt: bash.#Run & {
175+
input: img.output
176+
script: contents: "black --check ."
177+
}
178+
lint: bash.#Run & {
179+
input: img.output
180+
script: contents: "pylint --rcfile=.pylintrc genetic test && mypy genetic test"
181+
}
182+
test: bash.#Run & {
183+
input: img.output
184+
script: contents: "python -m pytest ."
185+
}
186+
}
187+
188+
}
189+
}

decision-tree/.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"dotnet-fsharplint": {
6-
"version": "0.21.2",
6+
"version": "0.21.3",
77
"commands": ["dotnet-fsharplint"]
88
},
99
"fantomas-tool": {

decision-tree/DecisionTree.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
2121
<PackageReference Include="NUnit" Version="3.13.3" />
22-
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
22+
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
2323
</ItemGroup>
2424

2525
</Project>

0 commit comments

Comments
 (0)