Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

402 add cuelang #403

Merged
merged 4 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ARG TF_VERSION=1.2.7
ARG MIGRATE_VERSION=4.15.2
ARG WATCH_VERSION=8.4.0
ARG CARGO_LLVM_COV_VERSION=0.5.36
ARG CUE_VERSION=0.11.1

RUN wget -O- https://carvel.dev/install.sh > install.sh && \
sudo bash install.sh && \
Expand All @@ -26,6 +27,10 @@ RUN wget -O- https://carvel.dev/install.sh > install.sh && \
tar -xf cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz && \
sudo mv cargo-llvm-cov /usr/local/bin && \
rm -rf cargo-llvm-cov* && \
wget https://github.com/cue-lang/cue/releases/download/v${CUE_VERSION}/cue_v${CUE_VERSION}_linux_amd64.tar.gz && \
tar -xf cue_v${CUE_VERSION}_linux_amd64.tar.gz && \
sudo mv cue /usr/local/bin && \
rm -rf cue_v${CUE_VERSION}_linux_amd64.tar.gz && \
npm install -g eslint && \
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - && \
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/project_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: project-conf

on:
push:
paths:
- project.yaml

jobs:
conf_test:
name: test types in project.yaml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cue-lang/[email protected]
with:
version: v0.11.1
id: install
- name: test project.yaml
run: cue vet ./cue/project_conf.cue project.yaml
11 changes: 11 additions & 0 deletions cue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<p align="center">
<img width="475" alt="systemaccounting" src="https://user-images.githubusercontent.com/12200465/37568924-06f05d08-2a99-11e8-8891-60f373b33421.png">
</p>

[cuelang](https://cuelang.org/docs/) uses:

test types in large `project.yaml` file. example command:

```sh
cue vet ./cue/project_conf.cue project.yaml
```
165 changes: 165 additions & 0 deletions cue/project_conf.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
package project_conf

#AppType: *"app" | "lib" | "tool"
#Runtime: *"rust1.x" | "bash"
#RustLog: "off"

#EnvVar: {
ssm!: *null | string
default!: *null | string | int | bool | [...string]
}

#EnvVars: {
set!: [string]: #EnvVar
get!: [...string]
}

#Params: [...string] // todo: remove

#Dir: {
env_var!: #EnvVars
params!: #Params
}

".github": {
#Dir
codecov: {
flags: [...string]
}
workflows: {
env_var!: #EnvVars
params!: #Params
}
}

#App: {
#Dir
runtime!: #Runtime
min_code_cov!: *null | int
type!: #AppType
local_dev!: *false | bool
deploy!: *true | bool
build_src_path!: *null | string
dependents!: [...string]
rust_log!: #RustLog
}

client!: {
#Dir
runtime!: "v8"
min_code_cov!: null
type!: #AppType
local_dev!: *false | bool
deploy!: *true | bool
}

#Lib: {
runtime!: #Runtime
min_code_cov!: *null | int
type!: #AppType
env_var!: #EnvVars
params!: #Params
}

crates: {
#Dir
httpclient: #Lib
pg: #Lib
types: #Lib
uribuilder: #Lib
wsclient: #Lib
}

docker: {
env_var!: #EnvVars
}

infra: {
terraform: {
env_var!: #EnvVars
aws: {
environments: {
region: {
env_var!: #EnvVars
}
}
modules: {
env_var!: #EnvVars
environment: {
env_var!: #EnvVars
}
microk8s: {
env_var!: #EnvVars
}
"project-storage": {
env_var!: #EnvVars
}
}
}
}
}

k8s: {
local: {
#Dir
type!: #AppType
}
dev: {
#Dir
type!: #AppType
}
}

migrations: {
#Dir
type!: #AppType
dumps: {
env_var!: #EnvVars
}
"go-migrate": #App
testseed: {
env_var!: #EnvVars
}
}

#Os: "osx"

#Dir

scripts!: {
env_var!: #EnvVars
}

services: {
#Dir
graphql!: #App
"request-create": #App
"request-approve": #App
rule: #App
"request-by-id": #App
"requests-by-account": #App
"transaction-by-id": #App
"transactions-by-account": #App
"balance-by-account": #App
event: #App
measure: #App
"auto-confirm": #App
}

tests: {
#Dir
runtime!: #Runtime
type!: #AppType
deploy: false
}

#Os: "osx"

#Tool: {
name!: string
os: [#Os]: {
install: string
}
}

".tools": [...#Tool]
5 changes: 5 additions & 0 deletions docker/.gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM gitpod/workspace-full:latest

ARG TF_VERSION=1.2.7
ARG CUE_VERSION=0.11.1

RUN bash -lc "rustup default stable" && \
wget -O- https://carvel.dev/install.sh > install.sh && \
Expand All @@ -17,6 +18,10 @@ RUN bash -lc "rustup default stable" && \
unzip terraform_${TF_VERSION}_linux_amd64.zip && \
sudo mv terraform /usr/local/bin && \
rm terraform_${TF_VERSION}_linux_amd64.zip && \
wget https://github.com/cue-lang/cue/releases/download/v${CUE_VERSION}/cue_v${CUE_VERSION}_linux_amd64.tar.gz && \
tar -xf cue_v${CUE_VERSION}_linux_amd64.tar.gz && \
sudo mv cue /usr/local/bin && \
rm -rf cue_v${CUE_VERSION}_linux_amd64.tar.gz && \
rustup component add llvm-tools-preview --toolchain stable-x86_64-unknown-linux-gnu && \
cargo install cargo-llvm-cov && \
brew install libpq && \
Expand Down
Loading
Loading