Skip to content

Commit d9dfccd

Browse files
authored
Merge pull request #40 from kcl-lang/chore-bump-kcl-lib-version-0.10.0-beta.1
chore: bump kcl lib version to 0.10.0-beta.2 and update release CI and dockerfile
2 parents 3db7797 + 033cab8 commit d9dfccd

File tree

13 files changed

+180
-17
lines changed

13 files changed

+180
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
test:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
container:
15+
image: plutolang/pluto
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
- name: Install dependencies
20+
run: |
21+
apt update
22+
apt install lsof
23+
npm install
24+
python3 -m pip install -r requirements.txt
25+
python3 -m pip install pytest
26+
- name: Build web
27+
run: cd web && npm install && npm run build
28+
- name: Test
29+
run: ./scripts/test.sh

.github/workflows/release.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
permissions:
7+
contents: write
8+
jobs:
9+
image:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
with:
20+
version: v0.11.2
21+
install: true
22+
23+
# <--- Login, build and push image to Docker Hub --->
24+
- name: Login to Docker Hub
25+
uses: docker/login-action@v3
26+
with:
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_PASSWORD }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: kcllang/pluto-kcl-playground
35+
- name: Build and push Docker image
36+
uses: docker/build-push-action@v6
37+
with:
38+
context: .
39+
platforms: linux/amd64
40+
push: ${{ github.event_name != 'pull_request' }}
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ zz_*
2222
node_modules
2323

2424
# pluto
25-
.pluto/**/*
25+
.pluto/**/*
26+
__pycache__

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM plutolang/pluto
2+
WORKDIR /
3+
COPY . .
4+
# Install Pluto and dev dependencies
5+
RUN npm install
6+
# Build frontend web application
7+
RUN cd web && npm install && npm run build
8+
# Install backend dependencies
9+
RUN python3 -m pip install -U -r ./requirements.txt
10+
# Run
11+
CMD ["pluto", "run"]
12+
EXPOSE 8080
13+
EXPOSE 8000
14+
EXPOSE 8001

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
## Quick Start
1212

1313
```shell
14-
python -m pip install -r requirements
14+
python3 -m pip install -U -r ./requirements.txt
1515
npm install
1616
npm install -g pluto
1717
make

app/main.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
import json
22
import re
33
import tempfile
4-
from pluto_client import Website, Router, HttpRequest, HttpResponse
4+
from pluto_client import (
5+
Website,
6+
WebsiteOptions,
7+
Router,
8+
RouterOptions,
9+
HttpRequest,
10+
HttpResponse,
11+
)
512
import kcl_lib.api as kcl_api
613

714
color_pattern = re.compile(r"\x1b\[[0-9;]+m")
815
api = kcl_api.API()
9-
router = Router("router")
10-
website = Website("./web/dist", "kcl-playground")
16+
router = Router("router", RouterOptions(sim_host="0.0.0.0", sim_port="8000"))
17+
website = Website(
18+
"./web/dist", "kcl-playground", WebsiteOptions(sim_host="0.0.0.0", sim_port="8001")
19+
)
1120
website.addEnv("BACKEND_URL", router.url())
1221

1322

app/main_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import requests
2+
from main import website, router
3+
4+
5+
def test_website():
6+
assert "8000" in website.url()
7+
8+
9+
def test_router():
10+
assert "8001" in router.url()

package-lock.json

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "kcl-playground",
3-
"version": "0.9.0",
2+
"name": "pluto-kcl-playground",
3+
"version": "0.10.0",
44
"scripts": {
55
"dev": "pluto run",
66
"test:dev": "pluto test --sim",

pluto.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
configs: {}
21
current: aws
32
language: python
43
stacks:
54
- configs: {}
65
name: aws
76
platformType: AWS
87
provisionType: Pulumi
8+
9+
configs:
10+
simulator:
11+
address: "0.0.0.0:8080"

0 commit comments

Comments
 (0)