Continuous Integration #644
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Continuous Integration | |
| on: [pull_request, workflow_dispatch] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| unit-test: | |
| runs-on: ubuntu-latest | |
| env: | |
| COVERAGE_FILE: coverage.xml | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build test image | |
| run: | | |
| DOCKER_BUILDKIT=1 docker build . \ | |
| --target python_test_base \ | |
| -t conductor-sdk-test:latest | |
| - name: Prepare coverage file | |
| run: touch ${{ env.COVERAGE_FILE }} | |
| - name: Run tests with coverage | |
| id: run_tests | |
| continue-on-error: true | |
| run: | | |
| docker run --rm \ | |
| -e CONDUCTOR_AUTH_KEY=${{ secrets.CONDUCTOR_AUTH_KEY }} \ | |
| -e CONDUCTOR_AUTH_SECRET=${{ secrets.CONDUCTOR_AUTH_SECRET }} \ | |
| -e CONDUCTOR_SERVER_URL=${{ secrets.CONDUCTOR_SERVER_URL }} \ | |
| -v ${{ github.workspace }}/${{ env.COVERAGE_FILE }}:/package/${{ env.COVERAGE_FILE }}:rw \ | |
| conductor-sdk-test:latest \ | |
| /bin/sh -c "coverage run -m unittest discover --verbose --start-directory=./tests/unit && \ | |
| coverage run --append -m unittest discover --verbose --start-directory=./tests/backwardcompatibility && \ | |
| coverage run --append -m unittest discover --verbose --start-directory=./tests/serdesertest && \ | |
| coverage run --append --source=./src/conductor/client/orkes -m unittest discover --verbose --start-directory=./tests/integration && \ | |
| coverage report -m && \ | |
| coverage xml -o /package/${{ env.COVERAGE_FILE }}" | |
| - name: Verify coverage file | |
| id: verify_coverage | |
| if: always() | |
| continue-on-error: true | |
| run: | | |
| if [ ! -s "${{ env.COVERAGE_FILE }}" ]; then | |
| echo "Coverage file is empty or does not exist" | |
| exit 1 | |
| fi | |
| echo "Coverage file exists and is not empty" | |
| - name: Upload coverage to Codecov | |
| if: always() && steps.verify_coverage.outcome == 'success' | |
| continue-on-error: true | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ${{ env.COVERAGE_FILE }} | |
| - name: Check test results | |
| if: steps.run_tests.outcome == 'failure' | |
| run: exit 1 |