Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
325 changes: 161 additions & 164 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
java-version: '17'
gradle-version: '8.12.1'
node-version: '18.x'
gradle-test-parallelization: '30'
gradle-test-parallelization: '5'

# Prevent multiple simultaneous runs except on main repo
concurrency:
Expand Down Expand Up @@ -39,8 +39,8 @@ jobs:
echo '{' > workflow-info.json
echo ' "pr_number": "${{ github.event.pull_request.number }}",' >> workflow-info.json
echo ' "commit": "${{ github.event.pull_request.head.sha || github.event.after || github.sha }}",' >> workflow-info.json
echo ' "branch": "${{ github.ref }}",' >> workflow-info.json
echo ' "commit_parent": "${{ github.event.pull_request.base.sha || github.event.before || github.base.sha }}",' >> workflow-info.json
echo ' "branch": "${{ github.base_ref }}",' >> workflow-info.json
# echo ' "commit_parent": "${{ github.event.pull_request.base.sha || github.event.before || github.base.sha }}",' >> workflow-info.json
echo ' "build_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",' >> workflow-info.json
echo ' "build": "${{ github.run_id }}"' >> workflow-info.json
echo '}' >> workflow-info.json
Expand Down Expand Up @@ -68,54 +68,54 @@ jobs:
env:
OS_MIGRATIONS_GRADLE_SCAN_TOS_AGREE_AND_ENABLED: ''

python-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-env
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install flake8
- name: Analysing the code with flake8
run: |
flake8 $(git ls-files '*.py')
# python-lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# - uses: ./.github/actions/setup-env
# - name: Install dependencies
# run: |
# python3 -m pip install --upgrade pip
# python3 -m pip install flake8
# - name: Analysing the code with flake8
# run: |
# flake8 $(git ls-files '*.py')

python-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py-project:
- migrationConsole/lib/console_link
- migrationConsole/cluster_tools
- k8sConfigMapUtilScripts
env:
WORKING_DIR: ./TrafficCapture/dockerSolution/src/main/docker/${{ matrix.py-project }}
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-env
- run: |
python3 -m pip install --upgrade pipenv
pipenv install --deploy --dev
pipenv graph
# python-tests:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# py-project:
# - migrationConsole/lib/console_link
# - migrationConsole/cluster_tools
# - k8sConfigMapUtilScripts
# env:
# WORKING_DIR: ./TrafficCapture/dockerSolution/src/main/docker/${{ matrix.py-project }}
# defaults:
# run:
# working-directory: ${{ env.WORKING_DIR }}
# steps:
# - uses: actions/checkout@v5
# - uses: ./.github/actions/setup-env
# - run: |
# python3 -m pip install --upgrade pipenv
# pipenv install --deploy --dev
# pipenv graph

- run: |
pipenv run test
pipenv run coverage xml
- name: Get Sanitized Name
env:
PY_PROJECT: ${{ matrix.py-project }}
run: echo "SANITIZED_PY_PROJECT=${PY_PROJECT//\//-}" >> $GITHUB_ENV
- name: Upload Coverage Reports
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: coverage-reports-python-tests-${{ env.SANITIZED_PY_PROJECT }}
path: ${{ env.WORKING_DIR }}/coverage.xml
# - run: |
# pipenv run test
# pipenv run coverage xml
# - name: Get Sanitized Name
# env:
# PY_PROJECT: ${{ matrix.py-project }}
# run: echo "SANITIZED_PY_PROJECT=${PY_PROJECT//\//-}" >> $GITHUB_ENV
# - name: Upload Coverage Reports
# uses: actions/upload-artifact@v4
# with:
# if-no-files-found: error
# name: coverage-reports-python-tests-${{ env.SANITIZED_PY_PROJECT }}
# path: ${{ env.WORKING_DIR }}/coverage.xml

generate-test-matrix:
runs-on: ubuntu-latest
Expand All @@ -141,17 +141,17 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-env
- name: Restore Docker Cache
uses: AndreKurait/[email protected]
with:
key: docker-${{ runner.os }}-${{ needs.generate-cache-key.outputs.docker_cache_key }}
# Delegate cache saving to python-e2e-tests
read-only: true
# - name: Restore Docker Cache
# uses: AndreKurait/[email protected]
# with:
# key: docker-${{ runner.os }}-${{ needs.generate-cache-key.outputs.docker_cache_key }}
# # Delegate cache saving to python-e2e-tests
# read-only: true

- name: Run Gradle tests with striping
run: |
MAX_WORKERS=$(( $(nproc) - 1 ))
gradle allTests \
gradle nonIsolatedTests \
--max-workers $MAX_WORKERS \
-Dtest.striping.total=${{ env.gradle-test-parallelization }} \
-Dtest.striping.index=${{ matrix.index }} \
Expand Down Expand Up @@ -184,14 +184,19 @@ jobs:
path: |
**/build/reports/tests/

- name: Publish Jacoco report artifact for stripe ${{ matrix.index }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true

- name: Upload Codecov report artifact for stripe ${{ matrix.index }}
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: coverage-exec-artifacts-gradle-tests-stripe-${{ matrix.index }}
name: coverage-report-artifacts-gradle-tests-stripe-${{ matrix.index }}
path: |
**/build/jacoco/*.exec
**/lcov.info

- name: Show disk usage
if: always()
Expand All @@ -203,130 +208,122 @@ jobs:
needs: [ gradle-tests ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-env
- name: Create clean .exec directory
run: rm -rf build/jacocoMerged && mkdir -p build/jacocoMerged

- name: Download all JaCoCo .exec files into directory expected by jacocoAggregateReport
- name: Download all codecov reports
uses: actions/download-artifact@v5
with:
path: build/jacocoMerged
pattern: coverage-exec-artifacts-gradle-tests-*
merge-multiple: true
path: reports
pattern: coverage-report-artifacts-gradle-tests-*
merge-multiple: false

- name: Generate aggregate JaCoCo report
run: gradle jacocoAggregateReport --stacktrace

- name: Upload Aggregate JaCoCo report
- name: Upload Coverate Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
if-no-files-found: error
name: coverage-reports-gradle-tests-aggregate
path: |
build/reports/jacoco/mergedReport/*
reports/*

python-e2e-tests:
needs: [ generate-cache-key ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-env
- name: Cache Docker Images
uses: AndreKurait/[email protected]
with:
key: docker-${{ runner.os }}-${{ needs.generate-cache-key.outputs.docker_cache_key }}
# Only save cache on push events
read-only: ${{ github.event_name != 'push' }}
- name: Start Docker Solution
run: gradle -p TrafficCapture dockerSolution:ComposeUp -x test -x spotlessCheck --info --stacktrace
env:
OS_MIGRATIONS_GRADLE_SCAN_TOS_AGREE_AND_ENABLED: ''
- name: Run E2E test script
run: |
docker exec $(docker ps --filter "name=migration-console" -q) pipenv run pytest /root/lib/integ_test/integ_test/replayer_tests.py --unique_id="testindex" -s
- name: Show disk usage
if: always()
run: |
df -h
docker system df -v
- name: Collect Docker, OpenSearch Benchmark, and Shared Logs
if: always()
run: |
mkdir -p logs/docker logs/opensearch_benchmark_logs logs/shared_logs_output
for container in $(docker ps -aq); do
container_name=$(docker inspect --format '{{.Name}}' $container | sed 's/\///')
docker logs $container > logs/docker/${container_name}_logs.txt 2>&1
done
docker cp $(docker ps --filter "name=migration-console" -q):/root/.benchmark/logs logs/opensearch_benchmark_logs
docker cp $(docker ps --filter "name=migration-console" -q):/shared-logs-output logs/shared_logs_output
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: e2e-test-logs
path: |
logs/docker
logs/opensearch_benchmark_logs
logs/shared_logs_output
- name: Clean up migrations docker images before caching
run: |
docker stop $(docker ps -q) && docker system prune --volumes -f
docker image ls --format '{{.Repository}}:{{.Tag}}' | grep '^migrations/' | xargs -I {} docker image rm {}
# python-e2e-tests:
# needs: [ generate-cache-key ]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# - uses: ./.github/actions/setup-env
# - name: Cache Docker Images
# uses: AndreKurait/[email protected]
# with:
# key: docker-${{ runner.os }}-${{ needs.generate-cache-key.outputs.docker_cache_key }}
# # Only save cache on push events
# read-only: ${{ github.event_name != 'push' }}
# - name: Start Docker Solution
# run: gradle -p TrafficCapture dockerSolution:ComposeUp -x test -x spotlessCheck --info --stacktrace
# env:
# OS_MIGRATIONS_GRADLE_SCAN_TOS_AGREE_AND_ENABLED: ''
# - name: Run E2E test script
# run: |
# docker exec $(docker ps --filter "name=migration-console" -q) pipenv run pytest /root/lib/integ_test/integ_test/replayer_tests.py --unique_id="testindex" -s
# - name: Show disk usage
# if: always()
# run: |
# df -h
# docker system df -v
# - name: Collect Docker, OpenSearch Benchmark, and Shared Logs
# if: always()
# run: |
# mkdir -p logs/docker logs/opensearch_benchmark_logs logs/shared_logs_output
# for container in $(docker ps -aq); do
# container_name=$(docker inspect --format '{{.Name}}' $container | sed 's/\///')
# docker logs $container > logs/docker/${container_name}_logs.txt 2>&1
# done
# docker cp $(docker ps --filter "name=migration-console" -q):/root/.benchmark/logs logs/opensearch_benchmark_logs
# docker cp $(docker ps --filter "name=migration-console" -q):/shared-logs-output logs/shared_logs_output
# - name: Upload Logs
# if: always()
# uses: actions/upload-artifact@v4
# with:
# if-no-files-found: error
# name: e2e-test-logs
# path: |
# logs/docker
# logs/opensearch_benchmark_logs
# logs/shared_logs_output
# - name: Clean up migrations docker images before caching
# run: |
# docker stop $(docker ps -q) && docker system prune --volumes -f
# docker image ls --format '{{.Repository}}:{{.Tag}}' | grep '^migrations/' | xargs -I {} docker image rm {}

node-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
npm-project:
- ./deployment/cdk/opensearch-service-migration
- ./deployment/migration-assistant-solution
- ./frontend
defaults:
run:
working-directory: ${{ matrix.npm-project }}
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-env
- name: Install NPM dependencies
run: npm ci
- name: Run CDK Jest Tests (using mocked images)
run: npm run test
# node-tests:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# npm-project:
# - ./deployment/cdk/opensearch-service-migration
# - ./deployment/migration-assistant-solution
# - ./frontend
# defaults:
# run:
# working-directory: ${{ matrix.npm-project }}
# steps:
# - uses: actions/checkout@v5
# - uses: ./.github/actions/setup-env
# - name: Install NPM dependencies
# run: npm ci
# - name: Run CDK Jest Tests (using mocked images)
# run: npm run test

link-checker:
runs-on: ubuntu-latest
# link-checker:
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- name: lychee Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: --verbose --accept=200,403,429 "**/*.html" "**/*.md" "**/*.txt" "**/*.json"
--offline
--exclude "file:///github/workspace/*"
--exclude "http://localhost*"
--exclude "https://localhost*"
--exclude "http://capture-proxy*"
--exclude "https://capture-proxy*"
--exclude-path "TrafficCapture/dockerSolution/src/main/docker/k8sConfigMapUtilScripts/tests/data"
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# steps:
# - uses: actions/checkout@v5
# - name: lychee Link Checker
# id: lychee
# uses: lycheeverse/lychee-action@v2
# with:
# args: --verbose --accept=200,403,429 "**/*.html" "**/*.md" "**/*.txt" "**/*.json"
# --offline
# --exclude "file:///github/workspace/*"
# --exclude "http://localhost*"
# --exclude "https://localhost*"
# --exclude "http://capture-proxy*"
# --exclude "https://capture-proxy*"
# --exclude-path "TrafficCapture/dockerSolution/src/main/docker/k8sConfigMapUtilScripts/tests/data"
# fail: true
# env:
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}


all-ci-checks-pass:
needs:
- python-tests
# - python-tests
- gradle-tests
- jacoco-aggregate
- link-checker
- node-tests
- python-e2e-tests
- python-lint
# - link-checker
# - node-tests
# - python-e2e-tests
# - python-lint
- gradle-extended-check
if: always()
runs-on: ubuntu-latest
Expand Down
Loading