forked from mattermost/mattermost
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (106 loc) · 4.38 KB
/
mmctl-test-template.yml
File metadata and controls
114 lines (106 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: mmctl CI
on:
workflow_call:
inputs:
name:
required: true
type: string
datasource:
required: true
type: string
drivername:
required: true
type: string
logsartifact:
required: true
type: string
go-version:
required: true
type: string
fips-enabled:
required: false
default: false
type: boolean
jobs:
test:
name: ${{ inputs.name }}
runs-on: ubuntu-22.04
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: Setup needed prepackaged plugins
run: |
cd server
make prepackaged-plugins PLUGIN_PACKAGES=mattermost-plugin-jira-v3.2.5
- 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 mmctl Tests
env:
BUILD_IMAGE: ${{ steps.build.outputs.BUILD_IMAGE }}
run: |
if [[ ${{ github.ref_name }} == 'master' ]]; then
export TESTFLAGS="-timeout 90m -race"
else
export TESTFLAGS="-timeout 30m"
fi
docker run --net ghactions_mm-test \
--ulimit nofile=8096:8096 \
--env-file=server/build/dotenv/test.env \
--env MM_SQLSETTINGS_DATASOURCE="${{ inputs.datasource }}" \
--env MMCTL_TESTFLAGS="$TESTFLAGS" \
--env FIPS_ENABLED="${{ inputs.fips-enabled }}" \
-v $PWD:/mattermost \
-w /mattermost/server \
$BUILD_IMAGE \
make test-mmctl BUILD_NUMBER=$GITHUB_HEAD_REF-$GITHUB_RUN_ID
- name: Stop docker compose
run: |
cd server/build
docker compose --ansi never stop
- name: Save mmctl test report to Zephyr Scale
if: ${{ always() && hashFiles('server/report.xml') != '' && github.event_name != 'pull_request' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release-')) }}
uses: ./.github/actions/save-junit-report-tms
with:
report-path: server/report.xml
zephyr-api-key: ${{ secrets.MM_E2E_ZEPHYR_API_KEY }}
build-image: ${{ steps.build.outputs.BUILD_IMAGE }}
- 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/test-name
server/pr-number