Repository navigation
feat(sdk): 添加批量操作功能并改进网络权限配置 #57
This file contains hidden or 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
| # Flexmodel CI/CD Pipeline | |
| # Runs tests for all modules, then builds and pushes Docker images. | |
| # Deploys to production on push to main. | |
| name: Run Tests | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| repository_dispatch: | |
| types: [ "ui_deploy" ] | |
| jobs: | |
| # ============================================================ | |
| # Test Jobs (run in parallel) | |
| # ============================================================ | |
| functions-runtime-test: | |
| name: functions-runtime tests (Deno) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Deno | |
| uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: "2.8.3" | |
| - name: Cache Deno dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/deno | |
| ~/.deno | |
| key: ${{ runner.os }}-deno-${{ hashFiles('flexmodel-functions-runtime/deno.json', 'flexmodel-functions-runtime/src/**/*.ts') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deno- | |
| - name: Run Deno tests | |
| working-directory: flexmodel-functions-runtime | |
| run: deno test --allow-all --unstable-worker-options | |
| engine-test: | |
| name: Engine tests (Java) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| ${{ runner.os }}-maven- | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Configure Maven settings | |
| env: | |
| GITHUB_USERNAME: cjbi | |
| MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} | |
| run: | | |
| mkdir -p ~/.m2 | |
| cp .github/settings.xml ~/.m2/settings.xml | |
| - name: Run engine tests | |
| run: mvn -B test -pl flexmodel-engine | |
| server-test: | |
| name: Server tests (Java) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| ${{ runner.os }}-maven- | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Configure Maven settings | |
| env: | |
| GITHUB_USERNAME: cjbi | |
| MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} | |
| run: | | |
| mkdir -p ~/.m2 | |
| cp .github/settings.xml ~/.m2/settings.xml | |
| - name: Run server tests | |
| # continue-on-error: some tests have known failures (see AGENTS.md) | |
| continue-on-error: true | |
| run: mvn -B test -pl flexmodel-server -am | |
| sdk-test: | |
| name: TypeScript SDK tests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: flexmodel-sdks/typescript | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: flexmodel-sdks/typescript/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| # ============================================================ | |
| # Build & Push Jobs (require corresponding tests to pass) | |
| # ============================================================ | |
| push-server-image: | |
| name: Push server docker image | |
| needs: [ engine-test, server-test ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| ${{ runner.os }}-maven- | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Configure Maven settings | |
| env: | |
| GITHUB_USERNAME: cjbi | |
| MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} | |
| run: | | |
| mkdir -p ~/.m2 | |
| cp .github/settings.xml ~/.m2/settings.xml | |
| - name: Build and push server image | |
| run: | | |
| mvn -B -Dmaven.test.skip=true clean package -pl flexmodel-server -am \ | |
| -Dquarkus.container-image.build=true \ | |
| -Dquarkus.container-image.push=true \ | |
| -Dquarkus.container-image.image=cjbi/flexmodel-server:latest \ | |
| -Dquarkus.container-image.username=${{ secrets.DOCKER_USERNAME }} \ | |
| -Dquarkus.container-image.password=${{ secrets.DOCKER_PASSWORD }} | |
| push-functions-runtime-image: | |
| name: Push functions-runtime docker image | |
| needs: [ functions-runtime-test ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push functions-runtime image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: flexmodel-functions-runtime | |
| push: true | |
| tags: cjbi/flexmodel-functions-runtime:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # ============================================================ | |
| # Deploy (requires both images to be pushed) | |
| # ============================================================ | |
| publish-sdk: | |
| name: Publish TypeScript SDK to npm | |
| needs: [ sdk-test ] | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: flexmodel-sdks/typescript | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| cache-dependency-path: flexmodel-sdks/typescript/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| push-ui-image: | |
| name: Push UI docker image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push UI image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: flexmodel-ui | |
| push: true | |
| tags: cjbi/flexmodel-ui:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # deploy: | |
| # runs-on: ubuntu-latest | |
| # needs: [ push-server-image, push-ui-image, push-functions-runtime-image ] | |
| # steps: | |
| # - name: Deploy Docker Image | |
| # uses: appleboy/ssh-action@master | |
| # with: | |
| # host: ${{ secrets.HOST }} | |
| # username: ${{ secrets.SSH_USER }} | |
| # port: ${{ secrets.SSH_PORT }} | |
| # key: ${{ secrets.SSH_KEY }} | |
| # command_timeout: 10m | |
| # script: | | |
| # cd /opt/flexmodel-quickstarts/docker-compose | |
| # docker-compose pull flexmodel-server flexmodel-ui flexmodel-functions-runtime | |
| # docker-compose up -d |