Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
name: Moodle Plugin CI
2
 
3
on: [push, pull_request]
4
 
5
jobs:
6
  test:
7
    runs-on: 'ubuntu-latest'
8
 
9
    services:
10
      postgres:
11
        image: postgres:13
12
        env:
13
          POSTGRES_USER: 'postgres'
14
          POSTGRES_HOST_AUTH_METHOD: 'trust'
15
        ports:
16
          - 5432:5432
17
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
18
 
19
      mariadb:
20
        image: mariadb:10
21
        env:
22
          MYSQL_USER: 'root'
23
          MYSQL_ALLOW_EMPTY_PASSWORD: "true"
24
          MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
25
          MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
26
        ports:
27
          - 3306:3306
28
        options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
29
 
30
    strategy:
31
      fail-fast: false
32
      matrix:
33
        include:
34
          - php: '8.2'
35
            moodle-branch: 'main'
36
            database: 'mariadb'
37
          - php: '8.2'
38
            moodle-branch: 'MOODLE_403_STABLE'
39
            database: 'pgsql'
40
          - php: '8.1'
41
            moodle-branch: 'MOODLE_402_STABLE'
42
            database: 'mariadb'
43
          - php: '8.0'
44
            moodle-branch: 'MOODLE_401_STABLE'
45
            database: 'pgsql'
46
          - php: '7.4'
47
            moodle-branch: 'MOODLE_400_STABLE'
48
            database: 'mariadb'
49
          - php: '7.3'
50
            moodle-branch: 'MOODLE_311_STABLE'
51
            database: 'pgsql'
52
          - php: '7.2'
53
            moodle-branch: 'MOODLE_39_STABLE'
54
            database: 'mariadb'
55
 
56
    steps:
57
      - name: Check out repository code
58
        uses: actions/checkout@v4
59
        with:
60
          path: plugin
61
 
62
      - name: Setup PHP ${{ matrix.php }}
63
        uses: shivammathur/setup-php@v2
64
        with:
65
          php-version: ${{ matrix.php }}
66
          extensions: ${{ matrix.extensions }}
67
          ini-values: max_input_vars=5000
68
          # If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug".
69
          # If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems).
70
          coverage: none
71
 
72
      - name: Initialise moodle-plugin-ci
73
        if: ${{ matrix.php >= '7.4' }}
74
        run: |
75
          composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
76
 
77
      - name: Initialise moodle-plugin-ci v3
78
        if: ${{ matrix.php < '7.4' }}
79
        run: |
80
          composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
81
 
82
      - name: Set up environment
83
        run: |
84
          echo $(cd ci/bin; pwd) >> $GITHUB_PATH
85
          echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
86
          sudo locale-gen en_AU.UTF-8
87
          echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
88
 
89
      - name: Install moodle-plugin-ci
90
        id: install_ci
91
        run: |
92
          moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
93
        env:
94
          DB: ${{ matrix.database }}
95
          MOODLE_BRANCH: ${{ matrix.moodle-branch }}
96
          MUSTACHE_IGNORE_NAMES: 'mobile_view_page_latest.mustache,mobile_view_page_ionic3.mustache'
97
          # Uncomment this to run Behat tests using the Moodle App.
98
          # MOODLE_APP: 'true'
99
 
100
      - name: PHP Lint
101
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
102
        run: moodle-plugin-ci phplint
103
 
104
      - name: PHP Mess Detector
105
        continue-on-error: true # This step will show errors but will not fail
106
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
107
        run: moodle-plugin-ci phpmd
108
 
109
      - name: Moodle Code Checker
110
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
111
        run: moodle-plugin-ci codechecker --max-warnings 0
112
 
113
      - name: Moodle PHPDoc Checker
114
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' && matrix.php >= '7.4' }}
115
        run: moodle-plugin-ci phpdoc --max-warnings 0
116
 
117
      - name: Moodle PHPDoc Checker v3
118
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' && matrix.php < '7.4' }}
119
        run: moodle-plugin-ci phpdoc
120
 
121
      - name: Validating
122
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
123
        run: moodle-plugin-ci validate
124
 
125
      - name: Check upgrade savepoints
126
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
127
        run: moodle-plugin-ci savepoints
128
 
129
      - name: Mustache Lint
130
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
131
        run: moodle-plugin-ci mustache
132
 
133
      - name: Grunt
134
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
135
        run: moodle-plugin-ci grunt --max-lint-warnings 0 || [ "$MOODLE_BRANCH" = 'MOODLE_39_STABLE' ] || [ "$MOODLE_BRANCH" = 'MOODLE_311_STABLE' ]
136
        env:
137
          MOODLE_BRANCH: ${{ matrix.moodle-branch }}
138
 
139
      - name: PHPUnit tests
140
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
141
        run: moodle-plugin-ci phpunit --fail-on-warning
142
 
143
      - name: Behat features
144
        id: behat
145
        if: ${{ !cancelled() && steps.install_ci.outcome == 'success' }}
146
        run: moodle-plugin-ci behat --profile chrome
147
 
148
      - name: Upload Behat Faildump
149
        if: ${{ failure() && steps.behat.outcome == 'failure' }}
150
        uses: actions/upload-artifact@v4
151
        with:
152
          name: Behat Faildump (${{ join(matrix.*, ', ') }})
153
          path: ${{ github.workspace }}/moodledata/behat_dump
154
          retention-days: 7
155
          if-no-files-found: ignore
156
 
157
      - name: Make sure cancelled jobs are marked as failures.
158
        if: ${{ cancelled() }}
159
        run: exit 1