From 0b9c0a057aa7a4fb3d82ca470da5c34008b32660 Mon Sep 17 00:00:00 2001 From: Gguidini Date: Thu, 7 Dec 2023 11:45:00 -0300 Subject: [PATCH] point CI to codecov staging --- .github/workflows/api.yml | 15 ++++----- .github/workflows/iterative_testing.yml | 12 +++---- .github/workflows/iterative_testing_reqs.yml | 35 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/iterative_testing_reqs.yml diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index b0db3d8..4624b65 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -19,7 +19,9 @@ jobs: with: python-version: '3.10.10' - name: Install requirements - run: pip install -r requirements.txt + run: | + pip install -r requirements.txt + pip install codecov-cli - name: Run tests and collect coverage (with labels) run: | python -m pytest ${{ matrix.app }}/** --cov=./${{ matrix.app }} --cov-report="xml:.artifacts/${{ matrix.app }}.coverage.xml" --cov-context=test @@ -27,7 +29,7 @@ jobs: - name: Upload to codecov uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 with: - token: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_STAGING_TOKEN }} flags: ${{ matrix.app }} files: .artifacts/${{ matrix.app }}.coverage.xml verbose: true @@ -41,11 +43,8 @@ jobs: rm .artifacts/core.coverage.xml - name: Upload to codecov - special case test ATS if: ${{ matrix.app == 'core' }} - uses: codecov/codecov-action@v4-beta + run: | + codecovcli --url=${{ secrets.CODECOV_STAGING_URL }} do-upload --flag smart-tests --plugin compress-pycoverage --file .artifacts/core.coverage.codecov.json --token=${CODECOV_TOKEN} env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: .artifacts/core.coverage.codecov.json - flags: smart-tests - plugins: compress-pycoverage + CODECOV_TOKEN: ${{ secrets.CODECOV_STAGING_TOKEN }} continue-on-error: true \ No newline at end of file diff --git a/.github/workflows/iterative_testing.yml b/.github/workflows/iterative_testing.yml index 2c8dfa2..916c6bc 100644 --- a/.github/workflows/iterative_testing.yml +++ b/.github/workflows/iterative_testing.yml @@ -28,14 +28,14 @@ jobs: # We need the setup to collect the list of tests properly - name: Download Codecov CLI run: | - pip install codecov-cli==0.4.0 + pip install codecov-cli==0.4.1 # Creates the commit and report objects in codecov - name: Codecov startup run: | codecovcli create-commit codecovcli create-report env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_STAGING_TOKEN }} # Sends static analysis information to codecov - name: Static Analysis run: | @@ -46,8 +46,8 @@ jobs: --folders-to-exclude static \ --folders-to-exclude bin env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - CODECOV_STATIC_TOKEN: ${{ secrets.STATIC_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_STAGING_TOKEN }} + CODECOV_STATIC_TOKEN: ${{ secrets.CODECOV_STAGING_STATIC_TOKEN }} - name: Install requirements run: pip install -r requirements.txt # Run label analysis in dry mode to get the list of tests to run @@ -86,8 +86,8 @@ jobs: exit 1 fi env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - CODECOV_STATIC_TOKEN: ${{ secrets.STATIC_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_STAGING_TOKEN }} + CODECOV_STATIC_TOKEN: ${{ secrets.CODECOV_STAGING_STATIC_TOKEN }} debug: runs-on: ubuntu-latest needs: coverage-ats diff --git a/.github/workflows/iterative_testing_reqs.yml b/.github/workflows/iterative_testing_reqs.yml new file mode 100644 index 0000000..247e9fa --- /dev/null +++ b/.github/workflows/iterative_testing_reqs.yml @@ -0,0 +1,35 @@ +name: Reqs for iterative testing + +on: + push: + +jobs: + prep-commit-for-ats: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: download codecov cli + run: | + pip install codecov-cli==0.4.1 + - name: Codecov startup + run: | + codecovcli --url=${{ secrets.CODECOV_STAGING_URL }} create-commit + codecovcli --url=${{ secrets.CODECOV_STAGING_URL }} create-report + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_STAGING_TOKEN }} + # Sends static analysis information to codecov + # This is used as an input in Codecov Automated Test Selection. + # It's necessary so we can use this commit as the BASE for comparison + - name: Static Analysis + run: | + codecovcli --url=${{ secrets.CODECOV_STAGING_URL }} static-analysis --token=${CODECOV_STATIC_TOKEN} \ + --folders-to-exclude .artifacts \ + --folders-to-exclude .github \ + --folders-to-exclude .venv + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_STAGING_TOKEN }} + CODECOV_STATIC_TOKEN: ${{ secrets.CODECOV_STAGING_STATIC_TOKEN }} +