Commit b3200482 by Jon Committed by GitHub

ci: add Forgejo platform support with custom variables (#7265)

* feat: forgejo CI workflow

* chore: add ci-workflow-sync skill, clean AGENTS.md
parent 5efe1187
name: Build fastgpt-code-sandbox images
on:
workflow_dispatch:
inputs:
version:
description: 'Image version tag (e.g. v4.15.0)'
required: true
type: string
push:
paths:
- 'projects/code-sandbox/**'
tags:
- 'v*'
jobs:
validate-version:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Validate release version
id: version
env:
VERSION_INPUT: ${{ github.event.inputs.version }}
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
EVENT_NAME: ${{ github.event_name }}
CURRENT_REF: ${{ github.ref }}
run: |
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
VERSION="$VERSION_INPUT"
else
VERSION="$REF_NAME"
if [[ "$REF_TYPE" != "tag" ]]; then
echo "::error::Release workflow must run on a tag starting with v. Current ref: ${CURRENT_REF}"
exit 1
fi
fi
if [[ ! "$VERSION" =~ ^v ]]; then
echo "::error::Image version must start with v. Current value: ${VERSION}"
exit 1
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
build-fastgpt-code-sandbox-images:
needs: validate-version
permissions:
packages: write
contents: read
strategy:
matrix:
include:
- arch: amd64
runs-on: ubuntu-24.04
- arch: arm64
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
# install env
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-sandbox-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-sandbox-buildx-
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
echo "SOURCE_URL=${{ github.server_url }}/${{ github.repository }}" >> "$GITHUB_ENV"
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build for ${{ matrix.arch }}
id: build
uses: docker/build-push-action@v6
env:
GODEBUG: madvdontneed=0
with:
context: .
file: projects/code-sandbox/Dockerfile
platforms: linux/${{ matrix.arch }}
build-args: |
HTTP_PROXY=${{ env.HTTP_PROXY }}
HTTPS_PROXY=${{ env.HTTPS_PROXY }}
NO_PROXY=${{ env.NO_PROXY }}
APT_MIRROR_UBUNTU=${{ env.APT_MIRROR_UBUNTU }}
APT_MIRROR_DEBIAN=${{ env.APT_MIRROR_DEBIAN }}
APT_MIRROR_DEBIAN_SECURITY=${{ env.APT_MIRROR_DEBIAN_SECURITY }}
NPM_REGISTRY=${{ env.NPM_REGISTRY }}
labels: |
org.opencontainers.image.source=${{ env.SOURCE_URL }}
org.opencontainers.image.description=fastgpt-code-sandbox image
outputs: type=image,"name=${{ env.REGISTRY }}/${{ github.repository_owner }}/fastgpt-code-sandbox",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: forgejo/upload-artifact@v4
with:
name: digests-fastgpt-code-sandbox-${{ github.sha }}-${{ matrix.arch }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
release-fastgpt-code-sandbox-images:
permissions:
packages: write
contents: read
needs: [validate-version, build-fastgpt-code-sandbox-images]
runs-on: ubuntu-24.04
steps:
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
echo "SOURCE_URL=${{ github.server_url }}/${{ github.repository }}" >> "$GITHUB_ENV"
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-fastgpt-code-sandbox-${{ github.sha }}-amd64
path: ${{ runner.temp }}/digests
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-fastgpt-code-sandbox-${{ github.sha }}-arm64
path: ${{ runner.temp }}/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Set image name and tag
run: |
VERSION="${{ needs.validate-version.outputs.version }}"
echo "Git_Tag=${REGISTRY}/${{ github.repository_owner }}/fastgpt-code-sandbox:${VERSION}" >> $GITHUB_ENV
echo "Git_Latest=${REGISTRY}/${{ github.repository_owner }}/fastgpt-code-sandbox:latest" >> $GITHUB_ENV
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
timeout-minutes: 120
env:
GODEBUG: http2client=0
run: |
SOURCE_REF="${REGISTRY}/${{ github.repository_owner }}/fastgpt-code-sandbox@sha256:%s"
SOURCES="$(printf "$SOURCE_REF " *)"
TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}")"
for TAG in $TAGS; do
docker buildx imagetools create -t "$TAG" $SOURCES
sleep 5
done
name: Build fastgpt agent helper images
on:
workflow_dispatch:
inputs:
ide_agent_tag:
description: 'fastgpt-ide-agent image tag'
required: false
default: latest
type: string
agent_sandbox_proxy_tag:
description: 'fastgpt-agent-sandbox-proxy image tag'
required: false
default: latest
type: string
jobs:
build-fastgpt-agent-helper-images:
permissions:
packages: write
contents: read
strategy:
matrix:
include:
- image: fastgpt-ide-agent
context: projects/fastgpt-ide-agent
dockerfile: projects/fastgpt-ide-agent/Dockerfile
description: fastgpt-ide-agent image
arch: amd64
runs-on: ubuntu-24.04
- image: fastgpt-ide-agent
context: projects/fastgpt-ide-agent
dockerfile: projects/fastgpt-ide-agent/Dockerfile
description: fastgpt-ide-agent image
arch: arm64
runs-on: ubuntu-24.04-arm
- image: fastgpt-agent-sandbox-proxy
context: projects/agent-sandbox-proxy
dockerfile: projects/agent-sandbox-proxy/Dockerfile
description: fastgpt-agent-sandbox-proxy image
arch: amd64
runs-on: ubuntu-24.04
- image: fastgpt-agent-sandbox-proxy
context: projects/agent-sandbox-proxy
dockerfile: projects/agent-sandbox-proxy/Dockerfile
description: fastgpt-agent-sandbox-proxy image
arch: arm64
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
# install env
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ matrix.image }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.image }}-buildx-
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
echo "SOURCE_URL=${{ github.server_url }}/${{ github.repository }}" >> "$GITHUB_ENV"
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build for ${{ matrix.arch }}
id: build
uses: docker/build-push-action@v6
env:
GODEBUG: madvdontneed=0
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
platforms: linux/${{ matrix.arch }}
build-args: |
HTTP_PROXY=${{ env.HTTP_PROXY }}
HTTPS_PROXY=${{ env.HTTPS_PROXY }}
NO_PROXY=${{ env.NO_PROXY }}
APT_MIRROR_UBUNTU=${{ env.APT_MIRROR_UBUNTU }}
APT_MIRROR_DEBIAN=${{ env.APT_MIRROR_DEBIAN }}
APT_MIRROR_DEBIAN_SECURITY=${{ env.APT_MIRROR_DEBIAN_SECURITY }}
NPM_REGISTRY=${{ env.NPM_REGISTRY }}
labels: |
org.opencontainers.image.source=${{ env.SOURCE_URL }}
org.opencontainers.image.description=${{ matrix.description }}
outputs: type=image,"name=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.image }}",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: forgejo/upload-artifact@v4
with:
name: digests-${{ matrix.image }}-${{ github.sha }}-${{ matrix.arch }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
release-fastgpt-agent-helper-images:
permissions:
packages: write
contents: read
needs: build-fastgpt-agent-helper-images
strategy:
matrix:
include:
- image: fastgpt-ide-agent
tag: ${{ inputs.ide_agent_tag || 'latest' }}
- image: fastgpt-agent-sandbox-proxy
tag: ${{ inputs.agent_sandbox_proxy_tag || 'latest' }}
runs-on: ubuntu-24.04
steps:
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
echo "SOURCE_URL=${{ github.server_url }}/${{ github.repository }}" >> "$GITHUB_ENV"
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-${{ matrix.image }}-${{ github.sha }}-amd64
path: ${{ runner.temp }}/digests
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-${{ matrix.image }}-${{ github.sha }}-arm64
path: ${{ runner.temp }}/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Set image name and tag
run: |
echo "Git_Tag=${REGISTRY}/${{ github.repository_owner }}/${{ matrix.image }}:${{ matrix.tag }}" >> $GITHUB_ENV
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
for TAG in "${Git_Tag}"; do
docker buildx imagetools create -t "${TAG}" \
$(printf "${REGISTRY}/${{ github.repository_owner }}/${{ matrix.image }}@sha256:%s " *)
sleep 5
done
name: Build fastgpt-marketplace images
on:
workflow_dispatch:
inputs:
version:
description: 'Image version tag (e.g. v1.0.0)'
required: true
type: string
jobs:
build-fastgpt-marketplace-images:
permissions:
packages: write
contents: read
strategy:
matrix:
include:
- arch: amd64
runs-on: ubuntu-24.04
- arch: arm64
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
# install env
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-marketplace-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-marketplace-buildx-
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
echo "SOURCE_URL=${{ github.server_url }}/${{ github.repository }}" >> "$GITHUB_ENV"
# login docker
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build for ${{ matrix.arch }}
id: build
uses: docker/build-push-action@v6
env:
GODEBUG: madvdontneed=0
with:
context: .
file: projects/marketplace/Dockerfile
platforms: linux/${{ matrix.arch }}
build-args: |
HTTP_PROXY=${{ env.HTTP_PROXY }}
HTTPS_PROXY=${{ env.HTTPS_PROXY }}
NO_PROXY=${{ env.NO_PROXY }}
APT_MIRROR_UBUNTU=${{ env.APT_MIRROR_UBUNTU }}
APT_MIRROR_DEBIAN=${{ env.APT_MIRROR_DEBIAN }}
APT_MIRROR_DEBIAN_SECURITY=${{ env.APT_MIRROR_DEBIAN_SECURITY }}
NPM_REGISTRY=${{ env.NPM_REGISTRY }}
labels: |
org.opencontainers.image.source=${{ env.SOURCE_URL }}
org.opencontainers.image.description=fastgpt-marketplace image
outputs: type=image,"name=${{ env.REGISTRY }}/${{ github.repository_owner }}/fastgpt-marketplace",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: forgejo/upload-artifact@v4
with:
name: digests-fastgpt-marketplace-${{ github.sha }}-${{ matrix.arch }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
release-fastgpt-marketplace-images:
permissions:
packages: write
contents: read
needs: build-fastgpt-marketplace-images
runs-on: ubuntu-24.04
steps:
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
echo "SOURCE_URL=${{ github.server_url }}/${{ github.repository }}" >> "$GITHUB_ENV"
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-fastgpt-marketplace-${{ github.sha }}-amd64
path: ${{ runner.temp }}/digests
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-fastgpt-marketplace-${{ github.sha }}-arm64
path: ${{ runner.temp }}/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Validate version
id: version
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
if [[ -z "$INPUT_VERSION" || ! "$INPUT_VERSION" =~ ^v ]]; then
echo "::error::Version must start with v. Current value: ${INPUT_VERSION:-<empty>}"
exit 1
fi
echo "version=${INPUT_VERSION}" >> "$GITHUB_OUTPUT"
- name: Set image name and tag
run: |
VERSION="${{ steps.version.outputs.version }}"
echo "Git_Tag=${REGISTRY}/${{ github.repository_owner }}/fastgpt-marketplace:${VERSION}" >> $GITHUB_ENV
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
SOURCE_REF="${REGISTRY}/${{ github.repository_owner }}/fastgpt-marketplace@sha256:%s"
retry_imagetools_create() {
local tag="$1"
local sources
sources="$(printf "$SOURCE_REF " *)"
for attempt in 1 2 3 4; do
if docker buildx imagetools create -t "$tag" $sources; then
return 0
fi
if [ "$attempt" -eq 4 ]; then
echo "::error::Failed to push manifest ${tag} after 3 retries."
return 1
fi
echo "::warning::Failed to push manifest ${tag}; retrying in $((attempt * 15)) seconds (${attempt}/3)."
sleep $((attempt * 15))
done
}
retry_imagetools_create "${Git_Tag}"
name: Build fastgpt-mcp-server images
on:
workflow_dispatch:
inputs:
version:
description: 'Image version tag (e.g. v1.0.0)'
required: true
type: string
jobs:
validate-version:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Validate release version
id: version
env:
VERSION: ${{ github.event.inputs.version }}
run: |
if [[ ! "$VERSION" =~ ^v ]]; then
echo "::error::Image version must start with v. Current value: ${VERSION}"
exit 1
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
build-fastgpt-mcp_server-images:
needs: validate-version
permissions:
packages: write
contents: read
strategy:
matrix:
include:
- arch: amd64
runs-on: ubuntu-24.04
- arch: arm64
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
# install env
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-mcp-server-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-mcp_server-buildx-
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
echo "SOURCE_URL=${{ github.server_url }}/${{ github.repository }}" >> "$GITHUB_ENV"
# login docker
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build for ${{ matrix.arch }}
id: build
uses: docker/build-push-action@v6
env:
GODEBUG: madvdontneed=0
with:
context: .
file: projects/mcp_server/Dockerfile
platforms: linux/${{ matrix.arch }}
build-args: |
HTTP_PROXY=${{ env.HTTP_PROXY }}
HTTPS_PROXY=${{ env.HTTPS_PROXY }}
NO_PROXY=${{ env.NO_PROXY }}
APT_MIRROR_UBUNTU=${{ env.APT_MIRROR_UBUNTU }}
APT_MIRROR_DEBIAN=${{ env.APT_MIRROR_DEBIAN }}
APT_MIRROR_DEBIAN_SECURITY=${{ env.APT_MIRROR_DEBIAN_SECURITY }}
NPM_REGISTRY=${{ env.NPM_REGISTRY }}
labels: |
org.opencontainers.image.source=${{ env.SOURCE_URL }}
org.opencontainers.image.description=fastgpt-mcp_server image
outputs: type=image,"name=${{ env.REGISTRY }}/${{ github.repository_owner }}/fastgpt-mcp_server",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: forgejo/upload-artifact@v4
with:
name: digests-fastgpt-mcp_server-${{ github.sha }}-${{ matrix.arch }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
release-fastgpt-mcp_server-images:
permissions:
packages: write
contents: read
needs: [validate-version, build-fastgpt-mcp_server-images]
runs-on: ubuntu-24.04
steps:
- name: Set platform variables
run: |
REGISTRY="${{ github.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_UBUNTU=${{ vars.AB_APT_MIRROR_UBUNTU }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN=${{ vars.AB_APT_MIRROR_DEBIAN }}" >> "$GITHUB_ENV"
echo "APT_MIRROR_DEBIAN_SECURITY=${{ vars.AB_APT_MIRROR_DEBIAN_SECURITY }}" >> "$GITHUB_ENV"
echo "NPM_REGISTRY=${{ vars.AB_NPM_REGISTRY }}" >> "$GITHUB_ENV"
- name: Write buildkitd config
run: |
REGISTRY_HOST="${{ github.server_url }}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST#http://}"
echo "REGISTRY_HOST=${REGISTRY_HOST}" >> "$GITHUB_ENV"
mkdir -p /tmp/buildkit
cat > /tmp/buildkit/buildkitd.toml << EOF
[registry."docker.io"]
mirrors = ["mirrors.sangfor.com"]
[registry."${REGISTRY_HOST}"]
http = true
insecure = true
EOF
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-fastgpt-mcp_server-${{ github.sha }}-amd64
path: ${{ runner.temp }}/digests
- name: Download digests
uses: forgejo/download-artifact@v4
with:
name: digests-fastgpt-mcp_server-${{ github.sha }}-arm64
path: ${{ runner.temp }}/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
env.GODEBUG=madvdontneed=0
env.HTTP_PROXY=${{ env.HTTP_PROXY }}
env.HTTPS_PROXY=${{ env.HTTPS_PROXY }}
env.NO_PROXY=${{ env.REGISTRY_HOST }}
config: /tmp/buildkit/buildkitd.toml
- name: Set image name and tag
run: |
VERSION="${{ needs.validate-version.outputs.version }}"
echo "Git_Tag=${REGISTRY}/${{ github.repository_owner }}/fastgpt-mcp_server:${VERSION}" >> $GITHUB_ENV
echo "Git_Latest=${REGISTRY}/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
retry_imagetools_create() {
local tag="$1"
local sources
sources="$(printf "${REGISTRY}/${{ github.repository_owner }}/fastgpt-mcp_server@sha256:%s " *)"
for attempt in 1 2 3 4; do
if docker buildx imagetools create -t "$tag" $sources; then
return 0
fi
if [ "$attempt" -eq 4 ]; then
echo "::error::Failed to push manifest ${tag} after 3 retries."
return 1
fi
echo "::warning::Failed to push manifest ${tag}; retrying in $((attempt * 15)) seconds (${attempt}/3)."
sleep $((attempt * 15))
done
}
TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}")"
for TAG in $TAGS; do
retry_imagetools_create "$TAG"
sleep 5
done
name: 'FastGPT-Test'
on:
pull_request:
paths:
- 'packages/global/**'
- 'packages/service/**'
- 'packages/web/**'
- 'projects/app/**'
- 'sdk/**'
- 'test/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'turbo.json'
- 'tsconfig.json'
- 'vitest.config.mts'
- 'eslint.config.mjs'
- '.npmrc'
- '.github/workflows/test-fastgpt.yaml'
workflow_dispatch:
# Only one build per PR branch at a time
concurrency:
group: 'test-fastgpt-${{ github.event.pull_request.number || github.ref }}'
cancel-in-progress: true
permissions:
# Required to checkout the code
contents: read
jobs:
test-global:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name ||
github.repository }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'
- name: 'Install Deps'
run: pnpm install --frozen-lockfile
- name: 'Test Global'
run: pnpm test:global
- name: 'Upload Coverage (Global)'
if: always() && hashFiles('packages/global/coverage/coverage-summary.json') != ''
uses: forgejo/upload-artifact@v4
with:
name: coverage-global
path: |
packages/global/coverage/coverage-final.json
packages/global/coverage/coverage-summary.json
test-service:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name ||
github.repository }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "MONGOMS_DOWNLOAD_DIR=$HOME/.cache/mongodb-binaries" >> "$GITHUB_ENV"
- name: Pre-download MongoDB binary
run: |
MONGODB_VERSION="7.0.14"
CACHE_DIR="$HOME/.cache/mongodb-binaries/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}"
if [ -f "${CACHE_DIR}/mongod" ]; then
echo "MongoDB binary already cached"
exit 0
fi
mkdir -p "${CACHE_DIR}"
echo "Downloading MongoDB ${MONGODB_VERSION} via proxy..."
curl --proxy "${{ vars.AB_HTTP_PROXY }}" -sL \
"https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}.tgz" \
| tar xz -C /tmp
cp /tmp/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}/bin/mongod "${CACHE_DIR}/mongod"
rm -rf /tmp/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}
echo "MongoDB binary cached at ${CACHE_DIR}/mongod"
- name: 'Install Deps'
run: pnpm install --frozen-lockfile
- name: 'Test Service'
run: pnpm test:service
- name: 'Upload Coverage (Service)'
if: always() && hashFiles('packages/service/coverage/coverage-summary.json') != ''
uses: forgejo/upload-artifact@v4
with:
name: coverage-service
path: |
packages/service/coverage/coverage-final.json
packages/service/coverage/coverage-summary.json
test-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name ||
github.repository }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'
- name: Capture proxy envs from variables
run: |
echo "HTTP_PROXY=${{ vars.AB_HTTP_PROXY }}" >> "$GITHUB_ENV"
echo "HTTPS_PROXY=${{ vars.AB_HTTPS_PROXY }}" >> "$GITHUB_ENV"
echo "NO_PROXY=${{ vars.AB_NO_PROXY }}" >> "$GITHUB_ENV"
echo "MONGOMS_DOWNLOAD_DIR=$HOME/.cache/mongodb-binaries" >> "$GITHUB_ENV"
- name: Pre-download MongoDB binary
run: |
MONGODB_VERSION="7.0.14"
CACHE_DIR="$HOME/.cache/mongodb-binaries/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}"
if [ -f "${CACHE_DIR}/mongod" ]; then
echo "MongoDB binary already cached"
exit 0
fi
mkdir -p "${CACHE_DIR}"
echo "Downloading MongoDB ${MONGODB_VERSION} via proxy..."
curl --proxy "${{ vars.AB_HTTP_PROXY }}" -sL \
"https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}.tgz" \
| tar xz -C /tmp
cp /tmp/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}/bin/mongod "${CACHE_DIR}/mongod"
rm -rf /tmp/mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}
echo "MongoDB binary cached at ${CACHE_DIR}/mongod"
- name: 'Install Deps'
run: pnpm install --frozen-lockfile
- name: 'Test App'
run: pnpm test:app
- name: 'Upload Coverage (App)'
if: always() && hashFiles('projects/app/coverage/coverage-summary.json') != ''
uses: forgejo/upload-artifact@v4
with:
name: coverage-app
path: |
projects/app/coverage/coverage-final.json
projects/app/coverage/coverage-summary.json
report-coverage:
runs-on: ubuntu-latest
needs: [test-global, test-service, test-app]
if: ${{ always() }}
permissions:
contents: read
steps:
- name: 'Download Coverage Artifacts'
uses: forgejo/download-artifact@v4
with:
name: coverage-global
path: coverage-artifacts/coverage-global
continue-on-error: true
- name: 'Download Coverage Artifacts'
uses: forgejo/download-artifact@v4
with:
name: coverage-service
path: coverage-artifacts/coverage-service
continue-on-error: true
- name: 'Download Coverage Artifacts'
uses: forgejo/download-artifact@v4
with:
name: coverage-app
path: coverage-artifacts/coverage-app
continue-on-error: true
- name: 'Generate Coverage Summary'
if: github.event_name == 'pull_request'
run: |
node -e "
const fs = require('fs');
const path = require('path');
const marker = '<!-- fastgpt-coverage-report -->';
const packages = [
{ name: 'Global', dir: 'coverage-global' },
{ name: 'Service', dir: 'coverage-service' },
{ name: 'App', dir: 'coverage-app' }
];
const formatPct = (value) => {
if (typeof value !== 'number') return 'N/A';
return value.toFixed(2) + '%';
};
const rows = packages.map((pkg) => {
const summaryPath = path.join(process.cwd(), 'coverage-artifacts', pkg.dir, 'coverage-summary.json');
if (!fs.existsSync(summaryPath)) {
return '| ' + pkg.name + ' | N/A | N/A | N/A | N/A |';
}
const summary = JSON.parse(fs.readFileSync(summaryPath, 'utf8'));
const total = summary.total || {};
return '| ' + pkg.name + ' | ' +
formatPct(total.statements?.pct) + ' | ' +
formatPct(total.branches?.pct) + ' | ' +
formatPct(total.functions?.pct) + ' | ' +
formatPct(total.lines?.pct) + ' |';
});
const body = [
marker,
'## Coverage Report',
'',
'| Package | Statements | Branches | Functions | Lines |',
'| --- | ---: | ---: | ---: | ---: |',
...rows
].join('\n');
fs.writeFileSync(process.env.GITHUB_STEP_SUMMARY, body, { flag: 'a' });
"
- name: 'Check Test Results'
run: |
if { [ "${{ needs.test-global.result }}" != "success" ] &&
[ "${{ needs.test-global.result }}" != "skipped" ]; } ||
{ [ "${{ needs.test-service.result }}" != "success" ] &&
[ "${{ needs.test-service.result }}" != "skipped" ]; } ||
{ [ "${{ needs.test-app.result }}" != "success" ] &&
[ "${{ needs.test-app.result }}" != "skipped" ]; }; then
exit 1
fi
name: 'Rust-Agent-Test'
on:
pull_request:
paths:
- 'projects/agent-sandbox-proxy/**'
- 'projects/fastgpt-ide-agent/**'
- '.github/workflows/test-rust-agent.yaml'
push:
branches:
- main
paths:
- 'projects/agent-sandbox-proxy/**'
- 'projects/fastgpt-ide-agent/**'
- '.github/workflows/test-rust-agent.yaml'
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
test-rust-projects:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "fastgpt-rust-agent-cache"
workspaces: |
projects/agent-sandbox-proxy
projects/fastgpt-ide-agent
# --- agent-sandbox-proxy Checks & Tests ---
- name: Run agent-sandbox-proxy fmt check
run: cargo fmt --check
working-directory: projects/agent-sandbox-proxy
- name: Run agent-sandbox-proxy clippy check
run: cargo clippy --locked -- -D warnings
working-directory: projects/agent-sandbox-proxy
- name: Run agent-sandbox-proxy tests
run: cargo test --locked
working-directory: projects/agent-sandbox-proxy
# --- fastgpt-ide-agent Checks & Tests ---
- name: Run fastgpt-ide-agent fmt check
run: cargo fmt --check
working-directory: projects/fastgpt-ide-agent
- name: Run fastgpt-ide-agent clippy check
run: cargo clippy --locked -- -D warnings
working-directory: projects/fastgpt-ide-agent
- name: Run fastgpt-ide-agent tests
run: cargo test --locked
working-directory: projects/fastgpt-ide-agent
name: 'Sandbox-Test'
on:
pull_request:
paths:
- 'projects/code-sandbox/**'
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Dependencies
run: pnpm install
- name: Install Python Dependencies
run: pip install -r projects/code-sandbox/requirements.txt
- name: Build native Python sandbox library
run: |
export HTTP_PROXY="${{ vars.AB_HTTP_PROXY }}"
export HTTPS_PROXY="${{ vars.AB_HTTPS_PROXY }}"
export NO_PROXY="${{ vars.AB_NO_PROXY }}"
if ! which go; then
echo "Acquire::http::Proxy \"${{ vars.AB_HTTP_PROXY }}\";" | tee /etc/apt/apt.conf.d/99proxy
echo "Acquire::https::Proxy \"${{ vars.AB_HTTP_PROXY }}\";" | tee -a /etc/apt/apt.conf.d/99proxy
apt-get update -qq && apt-get install -y -qq golang-go libseccomp-dev
fi
cd projects/code-sandbox && pnpm run build:native:python
- name: Run Unit Tests
run: pnpm --filter=code-sandbox test
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment