Skip to content

πŸ”¨ improve the CICD process. #16

πŸ”¨ improve the CICD process.

πŸ”¨ improve the CICD process. #16

name: Docker Build All Images
concurrency:
group: docker-build-dev-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
branches: [develop]
push:
branches: [develop]
jobs:
build-main-amd64:
runs-on: ubuntu-latest
steps:
- name: Debug - Print PR files info
run: |
echo "=== PR Files Debug Info ==="
echo "Event name: ${{ github.event_name }}"
echo "PR number: ${{ github.event.pull_request.number }}"
echo "PR head ref: ${{ github.event.pull_request.head.ref }}"
echo "PR base ref: ${{ github.event.pull_request.base.ref }}"
# Try to get files via GitHub API
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "=== Fetching files via GitHub API ==="
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
jq -r '.[].filename' | head -20
fi
echo "=== Raw event data ==="
echo '${{ toJSON(github.event) }}'
echo "=== End Debug Info ==="
- name: Check if should run
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] || \
[[ "${{ contains(github.event.pull_request.files.*.filename, 'backend/') }}" == "true" ]] || \
[[ "${{ contains(github.event.pull_request.files.*.filename, 'sdk/') }}" == "true" ]] || \
[[ "${{ contains(github.event.pull_request.files.*.filename, 'make/main/') }}" == "true" ]]; then
echo "βœ… Job will run - conditions met"
exit 0
else
echo "❌ Job will skip - conditions not met"
exit 1
fi
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'backend/') ||
contains(github.event.pull_request.files.*.filename, 'sdk/') ||
contains(github.event.pull_request.files.*.filename, 'make/main/')
- name: Set up Docker Buildx
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'backend/') ||
contains(github.event.pull_request.files.*.filename, 'sdk/') ||
contains(github.event.pull_request.files.*.filename, 'make/main/')
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event_pull_request.files.*.filename, 'backend/') ||
contains(github.event_pull_request.files.*.filename, 'sdk/') ||
contains(github.event_pull_request.files.*.filename, 'make/main/')
uses: actions/checkout@v4
- name: Build main image (amd64) and load locally
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event_pull_request.files.*.filename, 'backend/') ||
contains(github.event_pull_request.files.*.filename, 'sdk/') ||
contains(github.event_pull_request.files.*.filename, 'make/main/')
run: |
docker buildx build --platform linux/amd64 -t nexent/nexent:dev-amd64 --load -f make/main/Dockerfile .
build-main-arm64:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'backend/') ||
contains(github.event.pull_request.files.*.filename, 'sdk/') ||
contains(github.event.pull_request.files.*.filename, 'make/main/')
steps:
- name: Set up Docker Buildx
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Build main image (arm64) and load locally
run: |
docker buildx build --platform linux/arm64 -t nexent/nexent:dev-arm64 --load -f make/main/Dockerfile .
build-data-process-amd64:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'backend/') ||
contains(github.event.pull_request.files.*.filename, 'sdk/') ||
contains(github.event.pull_request.files.*.filename, 'make/data_process/')
steps:
- name: Free up disk space on GitHub runner
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
- name: Set up Docker Buildx
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Clone model
run: |
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Nexent-AI/model-assets
cd ./model-assets
GIT_TRACE=1 GIT_CURL_VERBOSE=1 GIT_LFS_LOG=debug git lfs pull
rm -rf .git .gitattributes
- name: Build data process image (amd64) and load locally
run: |
docker buildx build --platform linux/amd64 -t nexent/nexent-data-process:dev-amd64 --load -f make/data_process/Dockerfile .
build-data-process-arm64:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'backend/') ||
contains(github.event.pull_request.files.*.filename, 'sdk/') ||
contains(github.event.pull_request.files.*.filename, 'make/data_process/')
steps:
- name: Free up disk space on GitHub runner
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
- name: Set up Docker Buildx
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Clone model
run: |
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Nexent-AI/model-assets
cd ./model-assets
GIT_TRACE=1 GIT_CURL_VERBOSE=1 GIT_LFS_LOG=debug git lfs pull
rm -rf .git .gitattributes
- name: Build data process image (arm64) and load locally
run: |
docker buildx build --platform linux/arm64 -t nexent/nexent-data-process:dev-arm64 --load -f make/data_process/Dockerfile .
build-web-amd64:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'frontend/') ||
contains(github.event.pull_request.files.*.filename, 'make/web/')
steps:
- name: Set up Docker Buildx
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Build web image (amd64) and load locally
run: |
docker buildx build --platform linux/amd64 -t nexent/nexent-web:dev-amd64 --load -f make/web/Dockerfile .
build-web-arm64:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'frontend/') ||
contains(github.event.pull_request.files.*.filename, 'make/web/')
steps:
- name: Set up Docker Buildx
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Build web image (arm64) and load locally
run: |
docker buildx build --platform linux/amd64 -t nexent/nexent-web:dev-amd64 --load -f make/web/Dockerfile .
build-terminal-amd64:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'make/terminal/')
steps:
- name: Set up Docker Buildx
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Build terminal image (amd64) and load locally
run: |
docker buildx build --platform linux/amd64 -t nexent/nexent-ubuntu-terminal:dev-amd64 --load -f make/terminal/Dockerfile .
build-terminal-arm64:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.files.*.filename, 'make/terminal/')
steps:
- name: Set up Docker Buildx
run: |
if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then
docker buildx create --name nexent_builder --use
else
docker buildx use nexent_builder
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Build terminal image (arm64) and load locally
run: |
docker buildx build --platform linux/arm64 -t nexent/nexent-ubuntu-terminal:dev-arm64 --load -f make/terminal/Dockerfile .