Skip to content

Commit 33a43d3

Browse files
authored
Merge branch 'main' into linda-hasura
2 parents ec36945 + d237cb0 commit 33a43d3

File tree

528 files changed

+61684
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

528 files changed

+61684
-395
lines changed
Lines changed: 91 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,100 @@
11
name: Trigger Docs Samples Rebuild
2+
permissions:
3+
contents: read
4+
pull-requests: read
25

36
on:
4-
push:
5-
branches: main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
branches:
10+
- "**"
611
paths:
7-
- 'samples/**'
12+
- "samples/**"
813

914
jobs:
15+
# python-lint:
16+
# runs-on: ubuntu-latest
17+
# steps:
18+
# - name: Checkout code
19+
# uses: actions/checkout@v4
20+
21+
# - name: Get list of changed files
22+
# id: changed
23+
# run: |
24+
# files=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep '\.py$' || true)
25+
# echo "files=$files" >> "$GITHUB_OUTPUT"
26+
27+
# - name: Run Ruff linter
28+
# uses: astral-sh/ruff-action@v1
29+
# with:
30+
# args: check
31+
# src: ${{ steps.changed.outputs.files }}
32+
33+
# - name: Run Ruff formatter check
34+
# uses: astral-sh/ruff-action@v1
35+
# with:
36+
# args: "format --check"
37+
# src: ${{ steps.changed.outputs.files }}
38+
39+
js-ts-lint:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Set up Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: "20"
49+
50+
- name: Get list of changed JS/TS files
51+
id: changed_js
52+
run: |
53+
files=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep -E '\.(js|ts|jsx|tsx)$' || true)
54+
echo "files=$files" >> "$GITHUB_OUTPUT"
55+
56+
- name: Run ESLint (JS/TS only)
57+
run: |
58+
if [ -n "${{ steps.changed_js.outputs.files }}" ]; then
59+
npx eslint ${{ steps.changed_js.outputs.files }}
60+
else
61+
echo "No JS/TS files to lint."
62+
fi
63+
64+
- name: Run Prettier check (JS/TS only)
65+
run: |
66+
if [ -n "${{ steps.changed_js.outputs.files }}" ]; then
67+
npx prettier --check ${{ steps.changed_js.outputs.files }}
68+
else
69+
echo "No JS/TS files to format check."
70+
fi
71+
72+
# go-lint:
73+
# runs-on: ubuntu-latest
74+
# steps:
75+
# - name: Checkout code
76+
# uses: actions/checkout@v4
77+
78+
# - name: Set up Golang
79+
# uses: actions/setup-go@v5
80+
# with:
81+
# go-version: stable
82+
83+
# - name: Run golangci-lint
84+
# uses: golangci/golangci-lint-action@v8
85+
# with:
86+
# args: --enable gofmt --enable goimports
87+
# only-new-issues: true
88+
# version: latest
89+
1090
build-json:
1191
runs-on: ubuntu-latest
92+
# needs: [python-lint, js-ts-lint, go-lint]
93+
needs: [js-ts-lint]
1294
steps:
13-
- name: Trigger CLI Autodoc
14-
uses: peter-evans/repository-dispatch@v1
15-
with:
16-
token: ${{ secrets.DOCS_ACTION_TRIGGER_TOKEN }}
17-
repository: DefangLabs/defang-docs
18-
event-type: sample-update
95+
- name: Trigger CLI Autodoc
96+
uses: peter-evans/repository-dispatch@v1
97+
with:
98+
token: ${{ secrets.DOCS_ACTION_TRIGGER_TOKEN }}
99+
repository: DefangLabs/defang-docs
100+
event-type: sample-update

.github/workflows/check-sample.yml

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
./scripts/check-modified-samples.sh > modified.txt
3131
echo "@@ MODIFIED @@"
3232
cat modified.txt
33+
echo "@@ CHECKLIST @@"
34+
cat checklist.txt
3335
3436
# TODO: Uncomment the following lines to validate the Compose files
3537
# once we figure out how to prevent it from erroring on warnings.
@@ -42,50 +44,12 @@ jobs:
4244
uses: actions/github-script@v5
4345
with:
4446
script: |
45-
const fs = require('fs');
46-
const pr_number = context.issue.number;
47-
const marker = '## Samples Checklist';
48-
49-
// Read the checklist from the file
50-
let checklist = fs.readFileSync('checklist.txt', 'utf8').trim();
51-
let error = false;
52-
53-
if(!checklist) {
54-
checklist = "✅ All good!"
55-
}
56-
else {
57-
error = true;
58-
}
59-
60-
// Get the current PR
61-
const { data: pullRequest } = await github.rest.pulls.get({
62-
owner: context.repo.owner,
63-
repo: context.repo.repo,
64-
pull_number: pr_number
65-
});
66-
67-
let newBody;
68-
const body = pullRequest.body || "";
69-
const markerIndex = body.indexOf(marker);
70-
71-
if (markerIndex !== -1) {
72-
// Replace the content below the marker
73-
newBody = body.substring(0, markerIndex + marker.length) + "\n" + checklist;
74-
} else {
75-
// Append the checklist if the marker doesn't exist
76-
newBody = body + "\n" + marker + "\n" + checklist;
77-
}
78-
79-
// Update the PR description
80-
await github.rest.pulls.update({
81-
owner: context.repo.owner,
82-
repo: context.repo.repo,
83-
pull_number: pr_number,
84-
body: newBody
85-
});
86-
87-
if(error) {
88-
throw new Error("Incomplete samples checklist. Please fix the issues and try again.");
47+
const script = require('./scripts/add-checklist-to-pr.js');
48+
try {
49+
await script({github, context});
50+
core.info(`Checklist successfully added to PR description`);
51+
} catch (error) {
52+
core.setFailed(`Script execution failed: ${error.message}`);
8953
}
9054
9155
- name: Create / Update Template Repo

.github/workflows/deploy-changed-samples.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy Changed Samples
33
on:
44
pull_request:
55
paths:
6-
- 'samples/**'
6+
- "samples/**"
77

88
permissions:
99
contents: read
@@ -65,6 +65,7 @@ jobs:
6565
if: env.should_continue == 'true'
6666
env:
6767
FIXED_VERIFIER_PK: ${{ secrets.FIXED_VERIFIER_PK }}
68+
TEST_ANTHROPIC_API_KEY: ${{ secrets.TEST_ANTHROPIC_API_KEY }}
6869
TEST_AWS_ACCESS_KEY: ${{ secrets.TEST_AWS_ACCESS_KEY }}
6970
TEST_AWS_SECRET_KEY: ${{ secrets.TEST_AWS_SECRET_KEY }}
7071
TEST_BOARD_PASSWORD: ${{ secrets.TEST_BOARD_PASSWORD }}
@@ -81,6 +82,8 @@ jobs:
8182
TEST_MB_DB_PASS: ${{ secrets.TEST_MB_DB_PASS }}
8283
TEST_MB_DB_PORT: ${{ secrets.TEST_MB_DB_PORT }}
8384
TEST_MB_DB_USER: ${{ secrets.TEST_MB_DB_USER }}
85+
TEST_MISTRAL_API_KEY: ${{ secrets.TEST_MISTRAL_API_KEY }}
86+
TEST_MODEL: ${{ secrets.TEST_MODEL }}
8487
TEST_MONGO_INITDB_ROOT_USERNAME: ${{ secrets.TEST_MONGO_INITDB_ROOT_USERNAME }}
8588
TEST_MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.TEST_MONGO_INITDB_ROOT_PASSWORD }}
8689
TEST_NC_DB: ${{ secrets.TEST_NC_DB }}
@@ -91,11 +94,16 @@ jobs:
9194
TEST_NC_S3_ACCESS_SECRET: ${{ secrets.TEST_NC_S3_ACCESS_SECRET }}
9295
TEST_OPENAI_KEY: ${{ secrets.TEST_OPENAI_KEY }}
9396
TEST_POSTGRES_PASSWORD: ${{ secrets.TEST_POSTGRES_PASSWORD }}
97+
TEST_PROJECT_HONEYPOT_KEY: ${{ secrets.TEST_PROJECT_HONEYPOT_KEY}}
9498
TEST_QUEUE: ${{ secrets.TEST_QUEUE }}
99+
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
95100
TEST_SECRET_KEY_BASE: ${{ secrets.TEST_SECRET_KEY_BASE }}
96101
TEST_SESSION_SECRET: ${{ secrets.TEST_SESSION_SECRET }}
97102
TEST_SLACK_CHANNEL_ID: ${{ secrets.TEST_SLACK_CHANNEL_ID }}
98103
TEST_SLACK_TOKEN: ${{ secrets.TEST_SLACK_TOKEN }}
104+
TEST_SHARED_SECRETS: ${{ secrets.TEST_SHARED_SECRETS}}
105+
TEST_TAVILY_API_KEY: ${{ secrets.TEST_TAVILY_API_KEY }}
106+
TEST_ALLOWED_HOSTS: ${{ secrets.TEST_ALLOWED_HOSTS }}
99107
run: |
100108
SAMPLES=$(sed 's|^samples/||' changed_samples.txt | paste -s -d ',' -)
101109
echo "Running tests for samples: $SAMPLES"

.github/workflows/publish-sample-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- main
77

88
jobs:
9-
check_samples:
9+
publish_samples:
1010
runs-on: ubuntu-latest
1111
permissions:
1212
contents: write

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Defang Software Labs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ Browse through the [./samples](./samples) directory, or search and browse in the
66

77
## Adding Samples
88

9-
To start working on a new sample, run `. ./scripts/new-sample` from the root of the repository. This will create a new sample directory, with some basic scaffolding to get you started. Look for `#REMOVE_ME_AFTER_EDITING` in your new project to look for things that you should probably be changing/checking per sample. Feel free to remove files, like `compose.dev.yaml` if they aren't necessary for your sample.
9+
To start working on a new sample, run `. ./scripts/new-sample` from the root of the repository. This will create a new sample directory, with some basic scaffolding to get you started. Look for `#REMOVE_ME_AFTER_EDITING` in your new project to look for things that you should probably be changing/checking per sample. Feel free to remove files, like `compose.dev.yaml` if they aren't necessary for your sample.
10+
11+
### Testing Samples
12+
13+
When you add a new sample, make sure to add any config vals to the `deploy-changed-samples.yml` workflow. They need to be prefixed with `TEST_` and those values need to be set in the repo secrets.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
FROM mcr.microsoft.com/devcontainers/python:3.13-bookworm
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile",
4+
"context": ".."
5+
},
6+
"features": {
7+
"ghcr.io/defanglabs/devcontainer-feature/defang-cli:1.0.4": {},
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
9+
"ghcr.io/devcontainers/features/aws-cli:1": {}
10+
}
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
environment: playground
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
steps:
17+
- name: Checkout Repo
18+
uses: actions/checkout@v4
19+
20+
- name: Deploy
21+
uses: DefangLabs/[email protected]
22+
with:
23+
config-env-vars: MISTRAL_API_KEY
24+
env:
25+
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}

samples/agentic-autogen/.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Environment variables
2+
.env
3+
.env.local
4+
.env.production
5+
6+
# Python
7+
__pycache__/
8+
/myenv
9+
10+
# Node.js
11+
node_modules/
12+
npm-debug.log*
13+
.pnpm-debug.log*
14+
15+
# Frontend build
16+
frontend/dist/
17+
frontend/build/
18+
19+
# IDE
20+
.vscode/
21+
.idea/
22+
*~
23+
24+
# OS
25+
.DS_Store
26+
._*
27+
Thumbs.db
28+
29+
# Optional npm cache directory
30+
.npm

0 commit comments

Comments
 (0)