Skip to content

Update Console Status Printing #1172

Update Console Status Printing

Update Console Status Printing #1172

Workflow file for this run

name: CI
on:
push:
pull_request:
env:
python-version: '3.10'
java-version: '11'
gradle-version: '8.0.2'
node-version: '18.x'
jobs:
python-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
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:
- ./FetchMigration/python
- ./TrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/console_link
defaults:
run:
working-directory: ${{ matrix.py-project }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- run: |
python -m pip install --upgrade pipenv
pipenv install --deploy --dev
pipenv run python -m coverage run -m pytest
pipenv run python -m coverage xml
- uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: python-test
gradle-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ env.java-version }}
distribution: 'corretto'
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.gradle-version }}
- name: Run Gradle Build
run: ./gradlew build -x test -x TrafficCapture:dockerSolution:build --scan --stacktrace
env:
OS_MIGRATIONS_GRADLE_SCAN_TOS_AGREE_AND_ENABLED: ''
- name: Run Tests with Coverage
run: ./gradlew test -x TrafficCapture:dockerSolution:build jacocoTestReport --scan --stacktrace
env:
OS_MIGRATIONS_GRADLE_SCAN_TOS_AGREE_AND_ENABLED: ''
- uses: actions/upload-artifact@v4
if: always()
with:
name: traffic-capture-test-reports
path: |
./TrafficCapture*/*/build/reports/
- uses: actions/upload-artifact@v4
if: always()
with:
name: RFS-test-reports
path: |
./RFS*/*/build/reports/
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: "**/jacocoTestReport.xml"
flags: gradle-test
fail_ci_if_error: false
python-e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ env.java-version }}
distribution: 'corretto'
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.gradle-version }}
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Generate Cache Key from Dockerfiles
id: generate_cache_key
run: |
files=$(find . -type f \( -name 'docker-compose.yml' -o -name 'Dockerfile' \))
file_contents=$(cat $files)
key=$(echo "${file_contents}" | sha1sum | awk '{print $1}')
echo "key=${key}" >> "$GITHUB_OUTPUT"
- name: Cache Docker Images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ steps.generate_cache_key.outputs.key }}
- name: Start Docker Solution
run: ./gradlew -p TrafficCapture dockerSolution:ComposeUp -x test --scan --info --stacktrace
env:
OS_MIGRATIONS_GRADLE_SCAN_TOS_AGREE_AND_ENABLED: ''
- name: Install python dependencies
working-directory: test
run: |
python -m pip install --upgrade pipenv
pipenv install --deploy --dev
- name: Run E2E test script
working-directory: test
run: |
pipenv run pytest tests.py --unique_id="testindex"
- name: Clean up migrations docker images before caching
run: |
docker stop $(docker ps -q) && docker rm $(docker ps -aq)
docker image ls --format '{{.Repository}}:{{.Tag}}' | grep '^migrations/' | grep -v '<none>' | xargs -I {} docker image rm {}
cdk-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./deployment/cdk/opensearch-service-migration
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
- name: Install NPM dependencies
run: npm ci
- name: Run CDK Jest Tests
run: npm test
link-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: lychee Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1
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-mail
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
fetch-migration-docker-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./FetchMigration
steps:
- uses: actions/checkout@v4
- name: Build Docker Image
run: docker build -t migrations/fetch-migration -f Dockerfile .
all-ci-checks-pass:
needs:
- cdk-tests
- gradle-tests
- link-checker
- python-e2e-tests
- python-lint
- python-tests
- fetch-migration-docker-build
runs-on: ubuntu-latest
steps:
- run: |
echo '## :heavy_check_mark: All continous integration checks pass' >> $GITHUB_STEP_SUMMARY