-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
13 changed files
with
180 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
container: | ||
image: plutolang/pluto | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
apt update | ||
apt install lsof | ||
npm install | ||
python3 -m pip install -r requirements.txt | ||
python3 -m pip install pytest | ||
- name: Build web | ||
run: cd web && npm install && npm run build | ||
- name: Test | ||
run: ./scripts/test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
permissions: | ||
contents: write | ||
jobs: | ||
image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
version: v0.11.2 | ||
install: true | ||
|
||
# <--- Login, build and push image to Docker Hub ---> | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: kcllang/pluto-kcl-playground | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,5 @@ zz_* | |
node_modules | ||
|
||
# pluto | ||
.pluto/**/* | ||
.pluto/**/* | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM plutolang/pluto | ||
WORKDIR / | ||
COPY . . | ||
# Install Pluto and dev dependencies | ||
RUN npm install | ||
# Build frontend web application | ||
RUN cd web && npm install && npm run build | ||
# Install backend dependencies | ||
RUN python3 -m pip install -U -r ./requirements.txt | ||
# Run | ||
CMD ["pluto", "run"] | ||
EXPOSE 8080 | ||
EXPOSE 8000 | ||
EXPOSE 8001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import requests | ||
from main import website, router | ||
|
||
|
||
def test_website(): | ||
assert "8000" in website.url() | ||
|
||
|
||
def test_router(): | ||
assert "8001" in router.url() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
configs: {} | ||
current: aws | ||
language: python | ||
stacks: | ||
- configs: {} | ||
name: aws | ||
platformType: AWS | ||
provisionType: Pulumi | ||
|
||
configs: | ||
simulator: | ||
address: "0.0.0.0:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pluto_client | ||
kcl_lib==0.9.0 | ||
kcl_lib==0.10.0b2 | ||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
# Start pluto locally | ||
TMP_OUTPUT_FILE=/tmp/pluto_output.log | ||
pluto run >$TMP_OUTPUT_FILE 2>&1 & | ||
PID1=$! | ||
|
||
# Wait for Pluto to start the project completely | ||
while :; do | ||
if grep -q "Successfully applied!" $TMP_OUTPUT_FILE; then | ||
echo "The project has been successfully started." | ||
break | ||
else | ||
echo "Waiting for Pluto to start the project..." | ||
sleep 1 | ||
fi | ||
done | ||
|
||
# Get the project name from package.json | ||
PROJECT_NAME=$(grep '"name":' package.json | awk -F '"' '{print $4}') | ||
echo "Project name: $PROJECT_NAME" | ||
|
||
# Set environment variables | ||
PORT=8080 | ||
export PLUTO_PROJECT_NAME=$PROJECT_NAME | ||
export PLUTO_STACK_NAME=local_run | ||
export PLUTO_PLATFORM_TYPE=Simulator | ||
export PLUTO_SIMULATOR_URL=http://localhost:$PORT | ||
|
||
# Run tests | ||
print_separator() { | ||
local message=$1 | ||
local message_len=${#message} | ||
|
||
local width=$(tput cols) | ||
local separator=$(printf '=%.0s' $(seq 1 $(((width - message_len - 4) / 2)))) | ||
local bold=$(tput bold) | ||
|
||
printf "\033[34m${bold}${separator}= %s =${separator}\033[0m\n" "$message" | ||
} | ||
|
||
# Output Pluto logs, which might contain useful information | ||
tail -f $TMP_OUTPUT_FILE -n 0 & | ||
PID2=$! | ||
|
||
# Execute tests in the app directory | ||
print_separator "Executing test files in the app directory" | ||
python3 -m pytest -s -q --no-header app | ||
|
||
# Execute tests within the app/main.py file | ||
print_separator "Executing tests within the app/main.py file" | ||
python3 -m pytest -s -q --no-header app/main.py | ||
|
||
# Cleanup | ||
kill $PID1 | ||
wait $PID1 | ||
kill $PID2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters