Since we have the auto-retry mechanism for replicas, there is not much benefit in trying 5 times before deciding to move on. In the earlier model, we would fail the server startup, so it made sense to check as many times as possible. Also reducing the sleep interval so that we can improve the boot up time in case of a bad replica. ```release-note NONE ``` * fix: Add job name to the publish report step --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>
107 строки
5.3 KiB
YAML
107 строки
5.3 KiB
YAML
name: Server Test Template
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
name:
|
|
required: true
|
|
type: string
|
|
datasource:
|
|
required: true
|
|
type: string
|
|
drivername:
|
|
required: true
|
|
type: string
|
|
logsartifact:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
test:
|
|
name: ${{ inputs.name }}
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
COMPOSE_PROJECT_NAME: ghactions
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
working-directory: ./server
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: server/go.sum
|
|
- name: Run docker compose
|
|
run: |
|
|
cd server/build
|
|
docker compose --ansi never run --rm start_dependencies
|
|
cat ../tests/test-data.ldif | docker compose --ansi never exec -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest';
|
|
docker compose --ansi never exec -T minio sh -c 'mkdir -p /data/mattermost-test';
|
|
docker compose --ansi never ps
|
|
- name: Run Tests
|
|
env:
|
|
BUILD_IMAGE: mattermostdevelopment/mattermost-build-server:${{ steps.go.outputs.GO_VERSION }}
|
|
run: |
|
|
if [[ ${{ github.ref_name }} == 'master' ]]; then
|
|
export RACE_MODE="-race"
|
|
fi
|
|
docker run --net ghactions_mm-test \
|
|
--ulimit nofile=8096:8096 \
|
|
--env-file=server/build/dotenv/test.env \
|
|
--env MM_SQLSETTINGS_DRIVERNAME="${{ inputs.drivername }}" \
|
|
--env MM_SQLSETTINGS_DATASOURCE="${{ inputs.datasource }}" \
|
|
--env TEST_DATABASE_MYSQL_DSN="${{ inputs.datasource }}" \
|
|
--env TEST_DATABASE_POSTGRESQL_DSN="${{ inputs.datasource }}" \
|
|
-v $(go env GOCACHE):/go/cache \
|
|
-e GOCACHE=/go/cache \
|
|
-v $PWD:/mattermost \
|
|
-w /mattermost/server \
|
|
$BUILD_IMAGE \
|
|
make test-server$RACE_MODE BUILD_NUMBER=$GITHUB_HEAD_REF-$GITHUB_RUN_ID
|
|
- name: Stop docker compose
|
|
run: |
|
|
cd server/build
|
|
docker compose --ansi never stop
|
|
- name: Archive logs
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
|
with:
|
|
name: ${{ inputs.logsartifact }}
|
|
path: |
|
|
server/gotestsum.json
|
|
server/report.xml
|
|
- name: Publish test report
|
|
id: report
|
|
uses: mikepenz/action-junit-report@ec3a351c13e080dc4fa94c49ab7ad5bf778a9668 # v3.7.7 + count retries + check urls from https://github.com/lieut-data/action-junit-report
|
|
if: success() || failure() # always run even if the previous step fails
|
|
with:
|
|
report_paths: server/report.xml
|
|
check_name: ${{ inputs.name }} (Results)
|
|
job_name: ${{ inputs.name }}
|
|
require_tests: true
|
|
- name: Report retried tests via webhook (master || release-*)
|
|
if: ${{ steps.report.outputs.retried > 0 && (github.ref_name == 'master' || startsWith(github.ref_name, 'release-')) }}
|
|
uses: mattermost/action-mattermost-notify@b7d118e440bf2749cd18a4a8c88e7092e696257a # v2.0.0
|
|
with:
|
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_COMMUNITY_DEVELOPERS_INCOMING_WEBHOOK_FROM_GH_ACTIONS }}
|
|
TEXT: |-
|
|
#### ⚠️ One or more flaky tests detected ⚠️
|
|
* Failing job: [github.com/mattermost/mattermost:${{ inputs.name }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
|
* Ideally, this would have been caught in a pull request, but now a volunteer is required. If you're willing to help, submit a separate pull request to skip the flaky tests (e.g. [23360](https://github.com/mattermost/mattermost/pull/23360)) and file JIRA ticket (e.g. [MM-52743](https://mattermost.atlassian.net/browse/MM-52743)) for later investigation.
|
|
* Finally, reply to this message with a link to the created JIRA ticket.
|
|
- name: Report retried tests (pull request)
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
if: ${{ steps.report.outputs.retried > 0 && !(github.ref_name == 'master' || startsWith(github.ref_name, 'release-')) }}
|
|
with:
|
|
script: |
|
|
const body = `#### ⚠️ One or more flaky tests detected ⚠️\n* Failing job: [github.com/mattermost/mattermost:${{ inputs.name }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n* Double check your code to ensure you haven't introduced a flaky test.\n* If this seems to be unrelated to your changes, submit a separate pull request to skip the flaky tests (e.g. [23360](https://github.com/mattermost/mattermost/pull/23360)) and file JIRA ticket (e.g. [MM-52743](https://mattermost.atlassian.net/browse/MM-52743)) for later investigation.`
|
|
|
|
await github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: body
|
|
})
|