Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out codecov upload #2933

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 34 additions & 20 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
python-version: ["3.7", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Cache pip packages"
uses: actions/cache@v3
uses: actions/cache@v4
id: pip-cache
with:
path: ~/.cache/pip
Expand All @@ -24,14 +24,14 @@ jobs:
${{ runner.os }}-pip-

- name: "Cache tox environments"
uses: actions/cache@v3
uses: actions/cache@v4
id: tox-cache
with:
path: .tox
key: ${{ runner.os }}-tox-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt', '**/requirements/*.txt', 'tox.ini') }}

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -84,32 +84,25 @@ jobs:

- name: Upload Selenium driver logs (${{ matrix.python-version }})
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pytest-logs
name: pytest-logs-${{ matrix.python-version }}
path: |
/tmp/pytest-of-runner

- name: "Upload coverage to Codecov"
if: github.repository_owner == 'Uninett'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # not required for forks of public repos

- name: Upload test reports (${{ matrix.python-version }})
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-reports
name: test-reports-${{ matrix.python-version }}
path: |
reports/**/*

- name: Upload core dumps (${{ matrix.python-version }})
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: core-dumps
name: core-dumps-${{ matrix.python-version }}
path: |
/tmp/core-*

Expand All @@ -130,11 +123,11 @@ jobs:
name: "Test Javascript code"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: browser-actions/setup-chrome@latest
- uses: browser-actions/setup-firefox@latest
- run: chrome --version
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16

Expand All @@ -149,8 +142,29 @@ jobs:

- name: Upload JavaScript test reports
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: javascript-test-reports
path: |
reports/**/*

upload-pr-number-base-sha:
name: Save PR number and base SHA in artifact
runs-on: ubuntu-latest
if: ${{ github.event.number && always() }}
env:
PR_NUMBER: ${{ github.event.number }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
steps:
- name: Make PR number file
run: |
mkdir -p ./extra
echo $PR_NUMBER > ./extra/pr_number
- name: Make base SHA file
run: |
echo $BASE_SHA > ./extra/base_sha
- name: Upload PR number file and base SHA file
uses: actions/upload-artifact@v4
with:
name: extra
path: extra/
4 changes: 2 additions & 2 deletions .github/workflows/dockercompose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: docker-compose build
run: |
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Send GitHub Action trigger data to Slack workflow
id: slack
if: failure()
uses: slackapi/slack-github-action@v1.23.0
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
Expand All @@ -48,7 +48,7 @@ jobs:
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter@v4
uses: github/super-linter/slim@v6
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/publish-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
publish-test-results:
name: "Publish test results"
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion != 'skipped'
if: github.event.workflow_run.conclusion != 'skipped' && github.repository_owner == 'Uninett'

steps:
- name: Download and Extract Artifacts
Expand All @@ -30,8 +29,37 @@ jobs:
done

- name: "Publish test results"
uses: EnricoMi/publish-unit-test-result-action/composite@v1
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
check_name: "Test results"
files: artifacts/**/*-results.xml

- name: Read PR number file
if: ${{ hashFiles('artifacts/extra/pr_number') != '' }}
run: |
pr_number=$(cat artifacts/extra/pr_number)
re='^[0-9]+$'
if [[ $pr_number =~ $re ]] ; then
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
fi

- name: Read base SHA file
if: ${{ hashFiles('artifacts/extra/base_sha') != '' }}
run: |
base_sha=$(cat artifacts/extra/base_sha)
re='[0-9a-f]{40}'
if [[ $base_sha =~ $re ]] ; then
echo "BASE_SHA=$base_sha" >> $GITHUB_ENV
fi

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
override_branch: ${{ github.event.workflow_run.head_branch}}
override_commit: ${{ github.event.workflow_run.head_sha}}
commit_parent: ${{ env.BASE_SHA }}
override_pr: ${{ env.PR_NUMBER }}
Loading