mattermost/.github/workflows/server-test-template.yml
Carlos Garcia 0f432a1ee3
Some checks failed
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres with binary parameters (push) Blocked by required conditions
Server CI / Postgres (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
BuildEnv Docker Image / build-image (push) Has been cancelled
BuildEnv Docker Image / build-image-fips (push) Has been cancelled
fixes registry used for mattermost-build-server image push and pull (#34882)
* fixes registry used for mattermost-build-server image push and pull

* fixes credentials needed for logging in to mattermosr registry
2026-01-08 19:57:02 +00:00

124 lines
4.6 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
fullyparallel:
required: false
type: boolean
default: false
enablecoverage:
required: false
type: boolean
default: false
go-version:
required: true
type: string
fips-enabled:
required: false
default: false
type: boolean
permissions:
id-token: write
contents: read
jobs:
test:
name: ${{ inputs.name }}
runs-on: ubuntu-latest-8-cores
continue-on-error: ${{ inputs.fullyparallel }} # Used to avoid blocking PRs in case of flakiness
env:
COMPOSE_PROJECT_NAME: ghactions
steps:
- name: buildenv/docker-login
# Only FIPS requires login for private build container. (Forks won't have credentials.)
if: inputs.fips-enabled
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout mattermost project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup BUILD_IMAGE
id: build
run: |
if [[ ${{ inputs.fips-enabled }} == 'true' ]]; then
echo "BUILD_IMAGE=mattermost/mattermost-build-server-fips:${{ inputs.go-version }}" >> "${GITHUB_OUTPUT}"
echo "LOG_ARTIFACT_NAME=${{ inputs.logsartifact }}-fips" >> "${GITHUB_OUTPUT}"
else
echo "BUILD_IMAGE=mattermost/mattermost-build-server:${{ inputs.go-version }}" >> "${GITHUB_OUTPUT}"
echo "LOG_ARTIFACT_NAME=${{ inputs.logsartifact }}" >> "${GITHUB_OUTPUT}"
fi
- name: Store required variables for publishing results
run: |
echo "${{ inputs.name }}" > server/test-name
echo "${{ github.event.pull_request.number }}" > server/pr-number
- name: Run docker compose
run: |
cd server/build
docker compose --ansi never run --rm start_dependencies
cat ../tests/custom-schema-objectID.ldif | docker compose --ansi never exec -T openldap bash -c 'ldapadd -Y EXTERNAL -H ldapi:/// -w mostest || true';
cat ../tests/custom-schema-cpa.ldif | docker compose --ansi never exec -T openldap bash -c 'ldapadd -Y EXTERNAL -H ldapi:/// -w mostest || true';
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: ${{ steps.build.outputs.BUILD_IMAGE }}
run: |
if [[ ${{ github.ref_name }} == 'master' && ${{ inputs.fullyparallel }} != true ]]; 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_POSTGRESQL_DSN="${{ inputs.datasource }}" \
--env ENABLE_FULLY_PARALLEL_TESTS="${{ inputs.fullyparallel }}" \
--env ENABLE_COVERAGE="${{ inputs.enablecoverage }}" \
--env FIPS_ENABLED="${{ inputs.fips-enabled }}" \
-v $PWD:/mattermost \
-w /mattermost/server \
$BUILD_IMAGE \
make test-server$RACE_MODE BUILD_NUMBER=$GITHUB_HEAD_REF-$GITHUB_RUN_ID
- name: Upload coverage to Codecov
if: ${{ inputs.enablecoverage }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
files: server/cover.out
- name: Stop docker compose
run: |
cd server/build
docker compose --ansi never stop
- name: Archive logs
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ steps.build.outputs.LOG_ARTIFACT_NAME }}
path: |
server/gotestsum.json
server/report.xml
server/cover.out
server/test-name
server/pr-number