diff --git a/.dockerignore b/.dockerignore index f799e7d56..dbb694ba2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,5 +5,7 @@ spec.yaml target/ deploy/ tests/ -docker/Dockerfile -scripts/ +**/Dockerfile +script/ +.github/ +doc/ diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index bcbd15ab4..4093bd439 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -33,34 +33,40 @@ env: jobs: setup: - name: Setup Environment + name: 'Build CI image: ${{ matrix.service_name }}' runs-on: ubuntu-latest + strategy: + matrix: + include: + - docker_file_path: "Dockerfile" + service_name: "appflowy_cloud" + - docker_file_path: "./services/appflowy-worker/Dockerfile" + service_name: "appflowy_worker" + - docker_file_path: "./admin_frontend/Dockerfile" + service_name: "admin_frontend" steps: - uses: actions/checkout@v4 - - name: Install prerequisites - run: | - sudo apt-get update - sudo apt-get install protobuf-compiler - sudo update-ca-certificates - - - name: Build Docker Images - run: | - export DOCKER_DEFAULT_PLATFORM=linux/amd64 - cp deploy.env .env - docker compose build appflowy_cloud appflowy_worker admin_frontend - - - name: Push docker images to docker hub - run: | - docker tag appflowyinc/appflowy_cloud appflowyinc/appflowy_cloud:${GITHUB_SHA} - docker tag appflowyinc/appflowy_worker appflowyinc/appflowy_worker:${GITHUB_SHA} - docker tag appflowyinc/admin_frontend appflowyinc/admin_frontend:${GITHUB_SHA} - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login --username appflowyinc --password-stdin - docker push appflowyinc/appflowy_cloud:${GITHUB_SHA} - docker push appflowyinc/appflowy_worker:${GITHUB_SHA} - docker push appflowyinc/admin_frontend:${GITHUB_SHA} - APPFLOWY_WORKER_VERSION=${GITHUB_SHA} - APPFLOWY_CLOUD_VERSION=${GITHUB_SHA} - APPFLOWY_ADMIN_FRONTEND_VERSION=${GITHUB_SHA} + with: + fetch-depth: 1 + - 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_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and push ${{ matrix.service_name }} + uses: docker/build-push-action@v5 + with: + push: true + file: ${{ matrix.docker_file_path }} + tags: | + ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.service_name }}:${{ github.sha }} + build-args: | + PROFILE=release + FEATURES= + cache-from: type=gha + cache-to: type=gha,mode=max test: name: Integration Tests @@ -81,7 +87,6 @@ jobs: - uses: Swatinem/rust-cache@v2 with: toolchain: ${{ env.RUST_TOOLCHAIN }} - workspaces: "AppFlowy-Cloud" - name: Copy and rename deploy.env to .env run: cp deploy.env .env diff --git a/Dockerfile b/Dockerfile index e509fe47c..70a923110 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,6 @@ ARG PROFILE="release" COPY --from=planner /app/recipe.json recipe.json # Build our project dependencies -ENV CARGO_BUILD_JOBS=4 RUN cargo chef cook --release --recipe-path recipe.json COPY . . @@ -28,6 +27,7 @@ ENV SQLX_OFFLINE true # Build the project RUN echo "Building with profile: ${PROFILE}, features: ${FEATURES}, " +ENV CARGO_INCREMENTAL=false RUN cargo build --profile=${PROFILE} --features "${FEATURES}" --bin appflowy_cloud FROM debian:bookworm-slim AS runtime diff --git a/src/application.rs b/src/application.rs index c7f8cf03a..983407c65 100644 --- a/src/application.rs +++ b/src/application.rs @@ -100,7 +100,7 @@ impl Application { self.port } } - +// "test" pub async fn run_actix_server( listener: TcpListener, state: AppState, diff --git a/src/biz/access_request/ops.rs b/src/biz/access_request/ops.rs index 2be6b2501..2d66652b1 100644 --- a/src/biz/access_request/ops.rs +++ b/src/biz/access_request/ops.rs @@ -24,6 +24,7 @@ use shared_entity::dto::access_request_dto::{AccessRequest, AccessRequestView}; use sqlx::PgPool; use uuid::Uuid; +// Test pub async fn create_access_request( pg_pool: &PgPool, mailer: AFCloudMailer, diff --git a/src/biz/chat/metrics.rs b/src/biz/chat/metrics.rs index 69c0f8534..caffd476c 100644 --- a/src/biz/chat/metrics.rs +++ b/src/biz/chat/metrics.rs @@ -15,7 +15,7 @@ impl AIMetrics { let metrics = Self::default(); let realtime_registry = registry.sub_registry_with_prefix("ai"); - // Register each metric with the Prometheus registry + // (test) Register each metric with the Prometheus registry realtime_registry.register( "total_stream_count", "Total count of streams processed",