diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index df4431b000..a3bd8952a4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 @@ -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 }} @@ -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-* @@ -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 @@ -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/ diff --git a/.github/workflows/dockercompose.yml b/.github/workflows/dockercompose.yml index 893c299c3d..23f36c37ea 100644 --- a/.github/workflows/dockercompose.yml +++ b/.github/workflows/dockercompose.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: docker-compose build run: | @@ -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: | { diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 0a5d16cc48..e351306a02 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -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 @@ -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 diff --git a/.github/workflows/publish-test-results.yml b/.github/workflows/publish-test-results.yml index da798e1b9d..1b707951e7 100644 --- a/.github/workflows/publish-test-results.yml +++ b/.github/workflows/publish-test-results.yml @@ -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 @@ -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 }}