From bd80fbd9eaea928fc1ef853234816ed7c08fe352 Mon Sep 17 00:00:00 2001 From: Pasit Sangprachathanarak Date: Wed, 6 Aug 2025 23:16:42 +0700 Subject: [PATCH 1/4] Delete .gitmodules --- .gitmodules | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29bb2..0000000000 From 82ea790994e73e6b97ab05d002c3ce2c9534c217 Mon Sep 17 00:00:00 2001 From: Pasit Sangprachathanarak Date: Wed, 6 Aug 2025 23:21:09 +0700 Subject: [PATCH 2/4] Update main.yml --- .github/workflows/main.yml | 50 +++++++++++++++----------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1699261dbc..71cc1c9871 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,53 +1,43 @@ name: ci on: - - push - - pull_request + push: + pull_request: jobs: test: runs-on: ubuntu-24.04 - strategy: + fail-fast: false matrix: base_image: ["ubuntu:noble", "debian:bookworm"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Check available cgroups - run: | - mount | grep cgroup + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-docker-${{ matrix.base_image }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-docker-${{ matrix.base_image }}- - name: Build docker image run: | - docker compose -p cms -f docker/docker-compose.test.yml build \ - --build-arg BASE_IMAGE=${{ matrix.base_image }} testcms + docker buildx build \ + --cache-from type=local,src=/tmp/.buildx-cache \ + --cache-to type=local,dest=/tmp/.buildx-cache,mode=max \ + --build-arg BASE_IMAGE=${{ matrix.base_image }} \ + -t testcms . - name: Run tests - run: | - docker compose -p cms -f docker/docker-compose.test.yml run --rm testcms + run: docker compose -p cms -f docker/docker-compose.test.yml run --rm --attach-dependencies testcms - - name: Upload test results to Codecov + - name: Upload all coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/test-results-action@v1 - with: - files: ./codecov/junit.xml - flags: unittests - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Upload unit test coverage results to Codecov uses: codecov/codecov-action@v4 - if: ${{ !cancelled() }} - with: - files: ./codecov/unittests.xml - flags: unittests - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Upload functional test coverage results to Codecov - uses: codecov/codecov-action@v4 - if: ${{ !cancelled() }} with: - files: ./codecov/functionaltests.xml - flags: functionaltests + files: ./codecov/unittests.xml,./codecov/functionaltests.xml + flags: unittests,functionaltests token: ${{ secrets.CODECOV_TOKEN }} From 6e7b548cd54818b6d6f20c5122fa879009eba429 Mon Sep 17 00:00:00 2001 From: Pasit Sangprachathanarak Date: Wed, 6 Aug 2025 23:22:42 +0700 Subject: [PATCH 3/4] Update main.yml --- .github/workflows/main.yml | 57 +++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71cc1c9871..c138c255f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,42 +2,67 @@ name: ci on: push: + branches: [ main, develop ] pull_request: jobs: test: runs-on: ubuntu-24.04 + strategy: - fail-fast: false matrix: base_image: ["ubuntu:noble", "debian:bookworm"] steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - name: Cache Docker layers uses: actions/cache@v4 with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-docker-${{ matrix.base_image }}-${{ github.sha }} + path: /tmp/.docker-cache + key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} restore-keys: | - ${{ runner.os }}-docker-${{ matrix.base_image }}- + ${{ runner.os }}-docker- - - name: Build docker image - run: | - docker buildx build \ - --cache-from type=local,src=/tmp/.buildx-cache \ - --cache-to type=local,dest=/tmp/.buildx-cache,mode=max \ - --build-arg BASE_IMAGE=${{ matrix.base_image }} \ - -t testcms . + - name: Set up Docker buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/Dockerfile.test + push: false + tags: testcms + cache-from: type=local,src=/tmp/.docker-cache + cache-to: type=local,dest=/tmp/.docker-cache + build-args: BASE_IMAGE=${{ matrix.base_image }} - name: Run tests - run: docker compose -p cms -f docker/docker-compose.test.yml run --rm --attach-dependencies testcms + run: | + docker compose -p cms -f docker/docker-compose.test.yml run --rm testcms + + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + files: ./codecov/junit.xml + flags: unittests + token: ${{ secrets.CODECOV_TOKEN }} - - name: Upload all coverage to Codecov + - name: Upload unit test coverage results to Codecov + uses: codecov/codecov-action@v4 if: ${{ !cancelled() }} + with: + files: ./codecov/unittests.xml + flags: unittests + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload functional test coverage results to Codecov uses: codecov/codecov-action@v4 + if: ${{ !cancelled() }} with: - files: ./codecov/unittests.xml,./codecov/functionaltests.xml - flags: unittests,functionaltests + files: ./codecov/functionaltests.xml + flags: functionaltests token: ${{ secrets.CODECOV_TOKEN }} From b7ceab2e843ffe92927afee1bd01035dad87d9d2 Mon Sep 17 00:00:00 2001 From: Pasit Sangprachathanarak Date: Wed, 6 Aug 2025 23:23:00 +0700 Subject: [PATCH 4/4] Create .gitmodules --- .github/workflows/.gitmodules | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/.gitmodules diff --git a/.github/workflows/.gitmodules b/.github/workflows/.gitmodules new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/.github/workflows/.gitmodules @@ -0,0 +1 @@ +