From 595243c47cec313077f0999fa7e40e99f6b1cb3a Mon Sep 17 00:00:00 2001 From: Connor Stone <connorstone628@gmail.com> Date: Thu, 5 Oct 2023 09:45:10 -0400 Subject: [PATCH 1/2] adding coverage workflow --- .github/workflows/coverage.yaml | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/coverage.yaml diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000..f7b711b --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,55 @@ +name: Code Coverage + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Record State + run: | + pwd + echo github.ref is: ${{ github.ref }} + echo GITHUB_SHA is: $GITHUB_SHA + echo github.event_name is: ${{ github.event_name }} + echo github workspace: ${{ github.workspace }} + pip --version + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install pytest-cov + pip install wheel + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + shell: bash + - name: Install Light-House + run: | + cd $GITHUB_WORKSPACE/ + pip install -e . + pip show lighthouse + shell: bash + - name: Test with pytest + run: | + cd $GITHUB_WORKSPACE + pwd + pytest --cov-report=xml --cov=astrophot tests/ + cat coverage.xml + shell: bash + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + files: ${{ github.workspace }}/coverage.xml + fail_ci_if_error: true \ No newline at end of file From 3d1093e08823c30793f5479ed54798a99fb61f2a Mon Sep 17 00:00:00 2001 From: Connor Stone <connorstone628@gmail.com> Date: Thu, 5 Oct 2023 14:27:02 -0400 Subject: [PATCH 2/2] line needed to load test data --- .github/workflows/coverage.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index f7b711b..f27cc76 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -40,6 +40,11 @@ jobs: pip install -e . pip show lighthouse shell: bash + - name: Load Light-House data + run: | + cd $GITHUB_WORKSPACE/.github/workflows/ + python get_test_data.py + shell: bash - name: Test with pytest run: | cd $GITHUB_WORKSPACE