Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test.yml « workflows « .github - github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 83b9b474ea26076a94b1c040f4abc5d9d1291b3c (plain)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Test

on:
  pull_request:
  push:
    branches:
      - main
      - stable*

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php-versions: [7.4]
        nextcloud-versions: ['stable21', 'stable22', 'stable23']
        include:
            - php-versions: 7.4
              nextcloud-versions: stable24
            - php-versions: 8.0
              nextcloud-versions: stable24
            - php-versions: 7.4
              nextcloud-versions: master
            - php-versions: 8.0
              nextcloud-versions: master
    name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests
    steps:
    - name: Set up php${{ matrix.php-versions }}
      uses: shivammathur/setup-php@master
      with:
        php-version: ${{ matrix.php-versions }}
        tools: composer:v1
        extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip,gmp
        coverage: xdebug
    - name: Checkout Nextcloud
      run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-versions }} nextcloud
    - name: Install Nextcloud
      run: php -f nextcloud/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database sqlite --database-pass=''
    - name: Fix php-parser on stable20 incompatibility with phpunit 9.3+
      if: ${{ matrix.nextcloud-versions == 'stable20' }}
      working-directory: nextcloud/3rdparty
      run: composer require nikic/php-parser:4.10
    - name: Checkout Mail
      uses: actions/checkout@v3
      with:
        path: nextcloud/apps/mail
    - name: Install dependencies
      working-directory: nextcloud/apps/mail
      run: composer install
    - name: Run tests
      working-directory: nextcloud/apps/mail
      run: composer run test:unit
      env:
        XDEBUG_MODE: coverage
    - name: Report coverage
      uses: codecov/codecov-action@v3.1.0
      if: ${{ always() && matrix.nextcloud-versions == 'master' }}
      with:
        file: ./nextcloud/apps/mail/tests/clover.unit.xml
        flags: unittests
        fail_ci_if_error: true

  integration-tests:
      runs-on: ubuntu-latest
      strategy:
          matrix:
              php-versions: [7.4, 8.0]
              nextcloud-versions: ['master']
              db: ['sqlite', 'mysql', 'pgsql']
      name: php${{ matrix.php-versions }}-${{ matrix.db }} integration tests
      services:
          mail-service:
              image: christophwurst/imap-devel
              env:
                  MAILNAME: mail.domain.tld
                  MAIL_ADDRESS: user@domain.tld
                  MAIL_PASS: mypassword
              ports:
                  - 25:25
                  - 143:143
                  - 993:993
                  - 4190:4190
          mysql-service:
              image: mariadb:10.5
              env:
                  MYSQL_ROOT_PASSWORD: my-secret-pw
                  MYSQL_DATABASE: nextcloud
                  MYSQL_USER: nextcloud
                  MYSQL_PASSWORD: nextcloud
              ports:
                  - 3306:3306
              options: >-
                  --health-cmd="mysqladmin ping"
                  --health-interval=10s
                  --health-timeout=5s
                  --health-retries=3
          postgres-service:
              image: postgres
              env:
                  POSTGRES_USER: nextcloud
                  POSTGRES_DB: nextcloud
                  POSTGRES_PASSWORD: nextcloud
              ports:
                  - 5432:5432
              options: >-
                  --health-cmd pg_isready
                  --health-interval 10s
                  --health-timeout 5s
                  --health-retries 5
      steps:
          - name: Set up php${{ matrix.php-versions }}
            uses: shivammathur/setup-php@master
            with:
                php-version: ${{ matrix.php-versions }}
                tools: composer:v1
                extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip,gmp
                coverage: xdebug
          - name: Checkout Nextcloud
            run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-versions }} nextcloud
          - name: Install Nextcloud
            run: php -f nextcloud/occ maintenance:install --database-host 127.0.0.1 --database-name nextcloud --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass admin --database ${{ matrix.db }}
          - name: Checkout Mail
            uses: actions/checkout@v3
            with:
                path: nextcloud/apps/mail
          - name: Install dependencies
            working-directory: nextcloud/apps/mail
            run: composer install
          - name: Install Mail
            run: php -f nextcloud/occ app:enable mail
          - name: Configure Nextcloud for testing
            run: |
                php -f nextcloud/occ config:system:set debug --type bool --value true
                php -f nextcloud/occ config:system:set app.mail.verify-tls-peer --type bool --value false
          - name: Enable slow mysql query logs
            if: ${{ matrix.db == 'mysql' }}
            run: |
              echo "SET GLOBAL log_queries_not_using_indexes = 1;" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
              echo "SET GLOBAL slow_query_log=1;" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
              echo "SET GLOBAL log_output = 'table';" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
          - name: Run tests
            working-directory: nextcloud/apps/mail
            run: |
                ss -tunlp
                true | openssl s_client -crlf -connect 127.0.0.1:993
                composer run test:integration
            env:
                XDEBUG_MODE: coverage
          - name: Read slow queries
            if: ${{ always() }}
            run: echo "SELECT * FROM mysql.slow_log WHERE sql_text LIKE '%oc_mail%' AND sql_text NOT LIKE '%information_schema%'" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
          - name: Print debug logs
            if: ${{ always() }}
            run: cat nextcloud/data/horde_*.log
          - name: Report coverage
            uses: codecov/codecov-action@v3.1.0
            if: ${{ always() && matrix.db == 'mysql' }}
            with:
              file: ./nextcloud/apps/mail/tests/clover.integration.xml
              flags: integrationtests
              fail_ci_if_error: true
  frontend-unit-test:
      runs-on: ubuntu-latest
      name: Front-end unit tests
      steps:
          - uses: actions/checkout@v3
          - name: Set up Node
            uses: actions/setup-node@v3
            with:
                node-version: 12.x
          - name: npm install
            run: npm install
          - name: run tests
            run: npm run test
      env:
          CI: true