From 11170498b99bfb00b41223bb1efbe070636b0f5f Mon Sep 17 00:00:00 2001 From: Sergei A Mamonov Date: Wed, 20 May 2026 21:22:06 +0300 Subject: [PATCH 1/3] add init workflow --- .github/workflows/ci.yml | 30 ++++++++++ .github/workflows/reusable-compose.yml | 77 ++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/reusable-compose.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3e67ce2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: test docker compose + +on: + push: + pull_request: + workflow_dispatch: + # schedule: + # - cron: "0 2 * * *" # UTC + + + +jobs: + run_tests: + name: ${{ matrix.name }} + uses: ./.github/workflows/reusable-compose.yml + strategy: + fail-fast: false + matrix: + include: + - name: Minimal test + compose_file: docker-compose.yml + with: + runner: ${{ matrix.runner || 'ubuntu-24.04'}} + compose_file: ${{ matrix.compose_file }} + version: ${{ matrix.version || 'latest' }} + api_v2: ${{ matrix.api_v2 || false }} + upload_mapping: ${{ matrix.upload_mapping || false}} + project_name: ${{ matrix.project_name || 'fnm' }} + + diff --git a/.github/workflows/reusable-compose.yml b/.github/workflows/reusable-compose.yml new file mode 100644 index 0000000..0f025a5 --- /dev/null +++ b/.github/workflows/reusable-compose.yml @@ -0,0 +1,77 @@ +name: run docker compose + +on: + workflow_call: + inputs: + runner: + type: string + default: ubuntu-24.04 + compose_file: + type: string + default: docker-compose.yml + required: true + #path: + # type: string + # default: ${PWD} + version: + type: string + default: latest + api_v2: + type: boolean + default: false + upload_mapping: + type: boolean + default: false + project_name: + type: string + default: fnm + + +jobs: + run_test: + runs-on: ${{ inputs.runner}} + env: + DEBIAN_FRONTEND: noninteractive + COMPOSE_FILE: ${{ inputs.compose_file}} + FNM_VERSION: ${{ inputs.version}} + FNM_WEB_API_V2: ${{ inputs.api_v2}} + FNM_NOT_UPLOAD_ASN_MAPPING: ${{ inputs.upload_mapping}} + COMPOSE_PROJECT_NAME: ${{ inputs.project_name}} + FNM_PATH: ${{ github.workspace }} + + + steps: + - uses: actions/checkout@v6 + - run: apt update && apt install -y pwgen + - name: Generate .env file + env: + FNM_PATH: ${{ github.workspace }} + run: | + cat > .env << EOF + FNM_PATH=${{ github.workspace }} + FNM_VERSION=${{ env.FNM_VERSION}} + FNM_WEB_API_V2=${{ env.FNM_WEB_API_V2}} + FNM_NOT_UPLOAD_ASN_MAPPING=${{ env.FNM_NOT_UPLOAD_ASN_MAPPING}} + + COMPOSE_PROJECT_NAME=${{ env.COMPOSE_PROJECT_NAME}} + COMPOSE_FILE=${{ env.COMPOSE_FILE}} + EOF + cat .env + echo -e "${FNM_PATH}" + - run: docker compose config + - name: Pull images + run: docker compose pull + - name: Clean volumes + run: docker compose down --volumes --remove-orphans || true + - name: Remove storage dir + run: rm -rf ./storages + - name: Init secrets + run: ./init_secrets.sh + - name: Recreate volumes + run: ./create_storage_default_dirs.sh + - name: Run docker compose + run: docker compose up -d --wait + - run: docker compose ps -a + - run: docker compose logs + + From 33669326bed059e0db68da0ea81082cc943f1398 Mon Sep 17 00:00:00 2001 From: Sergei A Mamonov Date: Wed, 20 May 2026 21:24:15 +0300 Subject: [PATCH 2/3] add sudo to apt --- .github/workflows/reusable-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-compose.yml b/.github/workflows/reusable-compose.yml index 0f025a5..3fd95ce 100644 --- a/.github/workflows/reusable-compose.yml +++ b/.github/workflows/reusable-compose.yml @@ -42,7 +42,7 @@ jobs: steps: - uses: actions/checkout@v6 - - run: apt update && apt install -y pwgen + - run: sudo apt update && sudo apt install -y pwgen - name: Generate .env file env: FNM_PATH: ${{ github.workspace }} From db395306339f1684764c6d5cf5ed668dd66b9121 Mon Sep 17 00:00:00 2001 From: Sergei A Mamonov Date: Thu, 21 May 2026 17:00:32 +0300 Subject: [PATCH 3/3] add full test --- .github/workflows/ci.yml | 3 +++ .github/workflows/reusable-compose.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e67ce2..b3f948a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,9 @@ jobs: include: - name: Minimal test compose_file: docker-compose.yml + + - name: All comopose files test + compose_file: docker-compose.yml:docker-compose.gobgp.yml:docker-compose.clickhouse.yml:docker-compose.grafana.yml:docker-compose.trafficdb.yml:docker-compose.web-api.yml:docker-compose.gobgp.yml with: runner: ${{ matrix.runner || 'ubuntu-24.04'}} compose_file: ${{ matrix.compose_file }} diff --git a/.github/workflows/reusable-compose.yml b/.github/workflows/reusable-compose.yml index 3fd95ce..e1d55e9 100644 --- a/.github/workflows/reusable-compose.yml +++ b/.github/workflows/reusable-compose.yml @@ -72,6 +72,6 @@ jobs: - name: Run docker compose run: docker compose up -d --wait - run: docker compose ps -a - - run: docker compose logs + - run: docker compose logs fastnetmon