Skip to content

Commit

Permalink
feat: add ci for kcl
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Jan 31, 2024
1 parent 1dbe3bb commit e1d5e82
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v1
with:
go-version: "1.21"

- uses: kcl-lang/actions@main
with:
subcommand: test
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Flask Demo KCL manifests, we can run the command to get Kubernetes manifests with [KCL](https://kcl-lang.io).

## Run

```shell
kcl run
```

## Test

```shell
kcl
kcl test
```
2 changes: 1 addition & 1 deletion app.k
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ schema Container:
args?: [str]
env?: [Env]
volumes?: [Volume]
resources: Resource
resources?: Resource
ports: [ContainerPort]

schema ContainerPort:
Expand Down
1 change: 1 addition & 0 deletions kcl.mod
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
[package]

Empty file added kcl.mod.lock
Empty file.
18 changes: 18 additions & 0 deletions kubernetes_render_test.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import manifests

import app

# Convert the `App` model into Kubernetes Deployment and Service Manifests
test_kubernetesRender = lambda {
a = app.App {
name = "app"
containers.ngnix = {
image = "ngnix"
ports = [{containerPort = 80}]
}
service.ports = [{ port = 80 }]
}
deployment_got = kubernetesRender(a)
assert deployment_got[0].kind == "Deployment"
assert deployment_got[1].kind == "Service"
}

0 comments on commit e1d5e82

Please sign in to comment.