-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated coverage action from just tests
- Loading branch information
Showing
7 changed files
with
104 additions
and
115 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,125 +52,21 @@ jobs: | |
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade --upgrade-strategy eager pip | ||
pip install flake8 | ||
pip install coverage | ||
pip install -r requirements.txt | ||
pip install -r docs/requirements.txt | ||
# Run flake8 only for Python 3.9 | ||
- name: Lint with flake8 | ||
if: matrix.python-version == '3.9' | ||
run: | | ||
pip install flake8 | ||
flake8 . --count --show-source --statistics --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
# Run unittest with coverage for Python 3.9 | ||
- name: Test with unittest and coverage (v3.9) | ||
# Run unittest without coverage | ||
- name: Test with unittest | ||
env: | ||
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: matrix.python-version == '3.9' | ||
run: | | ||
pip install coverage | ||
coverage run -m unittest discover tests | ||
continue-on-error: true | ||
|
||
|
||
# Run unittest without coverage for non Python 3.9 | ||
- name: Test with unittest (non-3.9) | ||
env: | ||
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: matrix.python-version != '3.9' | ||
run: | | ||
python -m unittest discover tests | ||
continue-on-error: true | ||
# Run spec tests with coverage for Python 3.9 | ||
- name: Run spec_test coverage | ||
env: | ||
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: matrix.python-version == '3.9' | ||
run: | | ||
coverage run --append -m unittest discover tests/spec_tests | ||
ls -a | ||
continue-on-error: true | ||
# Run spec tests without coverage for non Python 3.9 | ||
- name: Run spec_test | ||
env: | ||
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: matrix.python-version != '3.9' | ||
run: | | ||
python -m unittest discover tests/spec_tests | ||
continue-on-error: true | ||
# Archive code coverage results for Python 3.9 | ||
- name: Archive code coverage results for Python 3.9 | ||
if: ${{matrix.python-version == '3.9'}} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: code-coverage-report | ||
path: .coverage | ||
if-no-files-found: error | ||
|
||
check-secret: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
secrets-exist: ${{ steps.check-for-secrets.outputs.defined }} | ||
steps: | ||
- name: Check for Secret availability | ||
id: check-for-secrets | ||
# perform secret check & put boolean result as an output | ||
shell: bash | ||
run: | | ||
if [ "${{ secrets.CC_TEST_REPORTER_ID }}" != '' ]; then | ||
echo "defined=true" >> $GITHUB_OUTPUT; | ||
else | ||
echo "defined=false" >> $GITHUB_OUTPUT; | ||
fi | ||
coverage: | ||
name: Publish coverage | ||
needs: [build, check-secret] | ||
runs-on: ubuntu-latest | ||
if: needs.check-secret.outputs.secrets-exist == 'true' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('docs/requirements.txt') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade --upgrade-strategy eager pip | ||
pip install flake8 | ||
pip install coverage | ||
pip install -r requirements.txt | ||
pip install -r docs/requirements.txt | ||
- name: Download a single artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: code-coverage-report | ||
|
||
- name: publish-coverages | ||
with: | ||
coverageCommand: coverage xml | ||
debug: true | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["*"] | ||
pull_request: | ||
branches: ["*"] | ||
|
||
jobs: | ||
|
||
check-secret: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
secrets-exist: ${{ steps.check-for-secrets.outputs.defined }} | ||
steps: | ||
- name: Check for Secret availability | ||
id: check-for-secrets | ||
# perform secret check & put boolean result as an output | ||
shell: bash | ||
run: | | ||
if [ "${{ secrets.CC_TEST_REPORTER_ID }}" != '' ]; then | ||
echo "defined=true" >> $GITHUB_OUTPUT; | ||
else | ||
echo "defined=false" >> $GITHUB_OUTPUT; | ||
fi | ||
build: | ||
needs: check-secret | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-latest] | ||
python-version: [ "3.9" ] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('docs/requirements.txt') }} | ||
|
||
# Install dependencies | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade --upgrade-strategy eager pip | ||
pip install flake8 | ||
pip install coverage | ||
pip install -r requirements.txt | ||
pip install -r docs/requirements.txt | ||
# Run flake8 only for Python 3.9 | ||
- name: Lint with flake8 | ||
run: | | ||
pip install flake8 | ||
flake8 . --count --show-source --statistics --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
# Run unittest with coverage | ||
- name: Test with unittest and coverage | ||
env: | ||
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
coverage run -m unittest discover tests | ||
continue-on-error: true | ||
# Run spec tests with coverage | ||
- name: Run spec_test coverage | ||
env: | ||
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
coverage run --append -m unittest discover tests/spec_tests | ||
continue-on-error: true | ||
- name: publish-coverages | ||
with: | ||
coverageCommand: coverage xml | ||
debug: true | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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