Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
43 efrain 1
name: Moodle Plugin CI
2
 
3
on: [push, pull_request]
4
 
5
jobs:
6
  test:
7
    runs-on: ubuntu-22.04
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
        php: ['7.4', '8.0', '8.1', '8.2']
34
        moodle-branch: [MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE]
35
        database: [pgsql, mariadb]
36
        # See: https://moodledev.io/general/development/policies/php
37
        exclude:
38
          - php: '7.4'
39
            moodle-branch: MOODLE_402_STABLE
40
          - php: '7.4'
41
            moodle-branch: MOODLE_403_STABLE
42
          - php: '8.0'
43
            moodle-branch: MOODLE_403_STABLE
44
          - php: '8.2'
45
            moodle-branch: MOODLE_401_STABLE
46
 
47
    steps:
48
      - name: Check out repository code
49
        uses: actions/checkout@v4
50
        with:
51
          path: plugin
52
 
53
      - name: Setup PHP ${{ matrix.php }}
54
        uses: shivammathur/setup-php@v2
55
        with:
56
          php-version: ${{ matrix.php }}
57
          extensions: ${{ matrix.extensions }}
58
          ini-values: max_input_vars=5000
59
          # If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug".
60
          # If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems).
61
          coverage: none
62
 
63
      - name: Initialise moodle-plugin-ci
64
        run: |
65
          composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
66
          echo $(cd ci/bin; pwd) >> $GITHUB_PATH
67
          echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
68
          sudo locale-gen en_AU.UTF-8
69
          echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
70
 
71
      - name: Install moodle-plugin-ci
72
        run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
73
        env:
74
          DB: ${{ matrix.database }}
75
          MOODLE_BRANCH: ${{ matrix.moodle-branch }}
76
          # Uncomment this to run Behat tests using the Moodle App.
77
          # MOODLE_APP: 'true'
78
 
79
      - name: PHP Lint
80
        if: ${{ !cancelled() }}
81
        run: moodle-plugin-ci phplint
82
 
83
      - name: PHP Copy/Paste Detector
84
        continue-on-error: true # This step will show errors but will not fail
85
        if: ${{ !cancelled() }}
86
        run: moodle-plugin-ci phpcpd
87
 
88
      - name: PHP Mess Detector
89
        continue-on-error: true # This step will show errors but will not fail
90
        if: ${{ !cancelled() }}
91
        run: moodle-plugin-ci phpmd
92
 
93
      - name: Moodle Code Checker
94
        if: ${{ !cancelled() }}
95
        run: moodle-plugin-ci phpcs --max-warnings 0
96
 
97
      - name: Moodle PHPDoc Checker
98
        if: ${{ !cancelled() }}
99
        run: moodle-plugin-ci phpdoc --max-warnings 0
100
 
101
      - name: Validating
102
        if: ${{ !cancelled() }}
103
        run: moodle-plugin-ci validate
104
 
105
      - name: Check upgrade savepoints
106
        if: ${{ !cancelled() }}
107
        run: moodle-plugin-ci savepoints
108
 
109
      - name: Mustache Lint
110
        if: ${{ !cancelled() }}
111
        run: moodle-plugin-ci mustache
112
 
113
      - name: Grunt
114
        if: ${{ !cancelled() }}
115
        run: moodle-plugin-ci grunt --max-lint-warnings 0
116
 
117
      - name: PHPUnit tests
118
        if: ${{ !cancelled() }}
119
        run: moodle-plugin-ci phpunit --fail-on-warning
120
 
121
      - name: Behat features
122
        if: ${{ !cancelled() }}
123
        run: moodle-plugin-ci behat --profile chrome
124
 
125
      - name: Mark cancelled jobs as failed.
126
        if: ${{ cancelled() }}
127
        run: exit 1