feat: update architecture docs (#1431) #1379
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
| name: CICD-PULL-REQUEST | ||
| on: | ||
| pull_request_review: | ||
| types: [submitted] | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
| BASE_BRANCH: origin/main | ||
| jobs: | ||
| trigger-mode: | ||
| name: trigger mode | ||
| if: github.event.review.state == 'approved' | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }} | ||
| matrix: ${{ steps.get_trigger_mode.outputs.matrix }} | ||
| steps: | ||
| - name: Cancel Previous Runs | ||
| uses: styfle/cancel-workflow-action@0.11.0 | ||
| with: | ||
| all_but_latest: true | ||
| access_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| - name: Get trigger mode | ||
| id: get_trigger_mode | ||
| run: | | ||
| git checkout -b ${{ github.event.pull_request.head.ref }} --track origin/${{ github.event.pull_request.head.ref }} | ||
| TRIGGER_MODE=`bash .github/utils/utils.sh --type 6 \ | ||
| --branch-name "${{ github.event.pull_request.head.ref }}" \ | ||
| --base-branch "${{ env.BASE_BRANCH }}"` | ||
| echo $TRIGGER_MODE | ||
| echo trigger_mode=$TRIGGER_MODE >> $GITHUB_OUTPUT | ||
| unit-test: | ||
| needs: trigger-mode | ||
| runs-on: ubuntu-latest | ||
| if: contains(needs.trigger-mode.outputs.trigger-mode, '[test]') | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.11" | ||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| version: "latest" | ||
| python-version: "3.11" | ||
| github-token: ${{ env.GITHUB_TOKEN }} | ||
| - name: make lint | ||
| run: | | ||
| pip install ruff | ||
| make lint | ||
| - name: unit test | ||
| run: | | ||
| make install | ||
| uv pip install pytest | ||
| make unit-test | ||
| check-image: | ||
| name: check image | ||
| needs: trigger-mode | ||
| if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]') | ||
| uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.49 | ||
| with: | ||
| IMG: "apecloud/aperag" | ||
| BUILDX_PLATFORMS: "linux/amd64" | ||
| DOCKERFILE_PATH: "./Dockerfile" | ||
| PYTHON_VERSION: "3.11" | ||
| secrets: inherit | ||
| check-frontend-image: | ||
| name: check frontend image | ||
| needs: trigger-mode | ||
| if: contains(needs.trigger-mode.outputs.trigger-mode, '[frontend]') | ||
| uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.49 | ||
| with: | ||
| IMG: "apecloud/aperag-frontend" | ||
| BUILDX_PLATFORMS: "linux/amd64" | ||
| DOCKERFILE_PATH: "./web/Dockerfile" | ||
| PYTHON_VERSION: "3.11" | ||
| MAKE_OPS_PRE: "build-aperag-frontend-assets" | ||
| secrets: inherit | ||
| check-helm: | ||
| name: check helm | ||
| needs: trigger-mode | ||
| if: contains(needs.trigger-mode.outputs.trigger-mode, '[deploy]') | ||
| uses: apecloud/apecloud-cd/.github/workflows/release-charts-check.yml@v0.1.48 | ||
| with: | ||
| VERSION: "v0.4.0-check" | ||
| CHART_NAME: "aperag" | ||
| CHART_DIR: "deploy" | ||
| APECD_REF: "v0.1.48" | ||
| secrets: inherit | ||
| e2e-test: | ||
| if: contains(needs.trigger-mode.outputs.trigger-mode, '[test]') | ||
| needs: trigger-mode | ||
| uses: ./.github/workflows/e2e-aperag.yml | ||
| secrets: inherit | ||
| pr-check: | ||
| name: PR Check | ||
| needs: [ trigger-mode, make-test, check-image, check-frontend-image, check-helm, e2e-test ] | ||
| if: ${{ github.event.review.state == 'approved' && always() }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: make test check | ||
| run: | | ||
| if [[ "${{ needs.make-test.result }}" == "failure" || "${{ needs.make-test.result }}" == "cancelled" ]]; then | ||
| echo "make test fail" | ||
| exit 1 | ||
| fi | ||
| - name: release image check | ||
| run: | | ||
| if [[ "${{ needs.check-image.result }}" == "failure" || "${{ needs.check-image.result }}" == "cancelled" ]]; then | ||
| echo "release image fail" | ||
| exit 1 | ||
| fi | ||
| - name: release frontend image check | ||
| run: | | ||
| if [[ "${{ needs.check-frontend-image.result }}" == "failure" || "${{ needs.check-frontend-image.result }}" == "cancelled" ]]; then | ||
| echo "release image fail" | ||
| exit 1 | ||
| fi | ||
| - name: release helm check | ||
| run: | | ||
| if [[ "${{ needs.check-helm.result }}" == "failure" || "${{ needs.check-helm.result }}" == "cancelled" ]]; then | ||
| echo "release helm fail" | ||
| exit 1 | ||
| fi | ||
| - name: e2e test check | ||
| run: | | ||
| if [[ "${{ needs.e2e-test.result }}" == "failure" || "${{ needs.e2e-test.result }}" == "cancelled" ]]; then | ||
| echo "release helm fail" | ||
| exit 1 | ||
| fi | ||