Repository navigation
refactor(server): 移除代码生成配置和服务 #3
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
| # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
| name: Run Tests | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| repository_dispatch: | |
| types: [ "engine_deploy", "ui_deploy" ] | |
| jobs: | |
| test: | |
| name: Run tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - 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 tests with Maven | |
| run: | | |
| mvn -B -U test | |
| - name: Caching Maven Dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| push-image: | |
| name: Push docker image | |
| needs: [ test ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - 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 Image with Maven | |
| run: | | |
| cd flexmodel-server | |
| mvn -B -U -Dmaven.test.skip=true clean package -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.container-image.image=cjbi/flexmodel:latest -Dquarkus.container-image.username=${{ secrets.DOCKER_USERNAME }} -Dquarkus.container-image.password=${{ secrets.DOCKER_PASSWORD }} | |
| - name: Caching Maven Dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: [ push-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 | |
| docker-compose up -d |