Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
name: Core
2
 
3
on:
4
  push:
5
    branches-ignore:
6
      - main
7
      - MOODLE_[0-9]+_STABLE
8
    tags-ignore:
9
      - v[0-9]+.[0-9]+.[0-9]+*
10
  workflow_dispatch:
11
    inputs:
12
      phpunit_extra_options:
13
        description: Additional options to apply to PHPUnit
14
        required: false
15
        default: ''
16
 
17
env:
18
  php: 8.4
19
 
20
jobs:
21
  Grunt:
22
    runs-on: ubuntu-24.04
23
 
24
    steps:
25
      - name: Checking out code
26
        uses: actions/checkout@v4
27
 
28
      - name: Configuring node & npm
29
        uses: actions/setup-node@v4
30
        with:
31
          node-version-file: '.nvmrc'
32
 
33
      - name: Installing node stuff
34
        run: npm install
35
 
36
      - name: Running grunt
37
        run: npx grunt
38
 
39
      - name: Looking for uncommitted changes
40
        # Add all files to the git index and then run diff --cached to see all changes.
41
        # This ensures that we get the status of all files, including new files.
42
        # We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
43
        run: |
44
          git add .
45
          git reset -- npm-shrinkwrap.json
46
          git diff --cached --exit-code
47
 
48
  PHPUnit:
49
    runs-on: ${{ matrix.os }}
50
    services:
51
      exttests:
52
        image: moodlehq/moodle-exttests
53
        ports:
54
          - 8080:80
55
      redis:
56
        image: redis
57
        ports:
58
          - 6379:6379
59
    strategy:
60
      fail-fast: false
61
      matrix:
62
        include:
63
          # MySQL builds always run with the lowest PHP supported version.
64
          - os: ubuntu-24.04
65
            php: 8.2
66
            extensions:
67
            db: mysqli
68
          # PostgreSQL builds always run with the highest PHP supported version.
69
          - os: ubuntu-24.04
70
            php: 8.4
71
            db: pgsql
72
 
73
    steps:
74
      - name: Setting up DB mysql
75
        if: ${{ matrix.db == 'mysqli' }}
76
        uses: moodlehq/mysql-action@v1
77
        with:
78
          collation server: utf8mb4_bin
79
          mysql version: 8.4
80
          mysql database: test
81
          mysql user: test
82
          mysql password: test
83
          use tmpfs: true
84
          tmpfs size: '1024M'
85
          extra conf: --skip-log-bin
86
 
87
      - name: Setting up DB pgsql
88
        if: ${{ matrix.db == 'pgsql' }}
89
        uses: m4nu56/postgresql-action@v1
90
        with:
91
          postgresql version: 14
92
          postgresql db: test
93
          postgresql user: test
94
          postgresql password: test
95
 
96
      - name: Configuring git vars
97
        uses: rlespinasse/github-slug-action@v4
98
 
99
      - name: Setting up PHP ${{ matrix.php }}
100
        uses: shivammathur/setup-php@v2
101
        with:
102
          php-version: ${{ matrix.php }}
103
          extensions: ${{ matrix.extensions }}
104
          ini-values: max_input_vars=5000
105
          coverage: none
106
 
107
      - name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
108
        uses: actions/checkout@v4
109
 
110
      - name: Setting up PHPUnit
111
        env:
112
          dbtype: ${{ matrix.db }}
113
        run: |
114
          echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
115
          cp .github/workflows/config-template.php config.php
116
          mkdir ../moodledata
117
          sudo locale-gen en_AU.UTF-8
118
          php admin/tool/phpunit/cli/init.php --no-composer-self-update
119
 
120
      - name: Running PHPUnit tests
121
        env:
122
          dbtype: ${{ matrix.db }}
123
          phpunit_options: ${{ secrets.phpunit_options }}
124
        run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
125
 
126
      - name: Git status
127
        run: git status