aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/msys2.yml
blob: 2bdcdd30e6f4ea52f3ad1f899539e20003903725 (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
name: msys2

concurrency:
  group: msys2-${{ github.head_ref || github.ref }}
  cancel-in-progress: true

on:
  push:
    paths:
      - "mesonbuild/**"
      - "test cases/**"
      - "unittests/**"
      - ".github/workflows/msys2.yml"
      - "run_unittests.py"
  pull_request:
    paths:
      - "mesonbuild/**"
      - "test cases/**"
      - "unittests/**"
      - ".github/workflows/msys2.yml"
      - "run_unittests.py"

permissions:
  contents: read

jobs:
  test:
    runs-on: windows-2019
    name: ${{ matrix.NAME }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - NAME: gccx86ninja
            MSYSTEM: MINGW32
            MSYS2_ARCH: i686
            MSYS2_CURSES: ncurses
            COMPILER: gcc
            TOOLCHAIN: toolchain
          - NAME: gccx64ninja
            MSYSTEM: MINGW64
            MSYS2_ARCH: x86_64
            MSYS2_CURSES: pdcurses
            COMPILER: gcc
            TOOLCHAIN: toolchain
          - NAME: clangx64ninja
            MSYSTEM: MINGW64
            MSYS2_ARCH: x86_64
            MSYS2_CURSES:
            COMPILER: clang
            TOOLCHAIN: clang
    env:
      MESON_CI_JOBNAME: msys2-${{ matrix.NAME }}

    defaults:
      run:
        shell: msys2 {0}

    steps:
      - uses: actions/checkout@v3

      - uses: msys2/setup-msys2@v2
        with:
          msystem: ${{ matrix.MSYSTEM }}
          update: true
          install: >-
            base-devel
            git
            mercurial
            lcov
            wget
            unzip
            mingw-w64-${{ matrix.MSYS2_ARCH }}-cmake
            mingw-w64-${{ matrix.MSYS2_ARCH }}-glib2
            mingw-w64-${{ matrix.MSYS2_ARCH }}-libxml2
            mingw-w64-${{ matrix.MSYS2_ARCH }}-ninja
            mingw-w64-${{ matrix.MSYS2_ARCH }}-pkg-config
            mingw-w64-${{ matrix.MSYS2_ARCH }}-python2
            mingw-w64-${{ matrix.MSYS2_ARCH }}-python
            mingw-w64-${{ matrix.MSYS2_ARCH }}-python-lxml
            mingw-w64-${{ matrix.MSYS2_ARCH }}-python-setuptools
            mingw-w64-${{ matrix.MSYS2_ARCH }}-python-pip
            mingw-w64-${{ matrix.MSYS2_ARCH }}-python-jsonschema
            mingw-w64-${{ matrix.MSYS2_ARCH }}-${{ matrix.TOOLCHAIN }}

      - name: Install dependencies
        run: |
          python3 -m pip --disable-pip-version-check install gcovr pefile pytest pytest-subtests pytest-xdist coverage

      - name: Install pypy3 on x86_64
        run: |
          mkdir pypy3local
          pushd pypy3local
          wget -nv https://downloads.python.org/pypy/pypy3.8-v7.3.9-win64.zip
          unzip pypy3.8-v7.3.9-win64.zip
          mv pypy3.8-v7.3.9-win64/* ./
          popd
        if: ${{ matrix.MSYS2_ARCH == 'x86_64' }}

      - name: Run Tests
        run: |
          if [[ "${{ matrix.MSYS2_ARCH }}" == "x86_64" ]]; then
            # There apparently is no clean way to add to the PATH in the 
            # previous step?
            # See for instance https://github.com/msys2/setup-msys2/issues/171
            export PATH=$PATH:$PWD/pypy3local
            # Make sure it is on the PATH
            pypy3 -c "import sys; print(sys.version)"
          fi
          export PATHEXT="$PATHEXT;.py"

          if [[ '${{ matrix.COMPILER }}' == 'clang' ]]; then
            export CC=clang
            export CXX=clang++
            export OBJC=clang
            export OBJCXX=clang++
          fi

          if [[ "${{ matrix.MSYS2_CURSES }}" != "" ]]; then
            pacman --noconfirm --needed -S mingw-w64-${{ matrix.MSYS2_ARCH }}-${{ matrix.MSYS2_CURSES }}
          fi

          MSYSTEM= python3 ./tools/run_with_cov.py run_tests.py --backend=ninja

      - uses: actions/upload-artifact@v3
        with:
          name: ${{ matrix.NAME }}
          path: meson-test-run.*

      - name: Aggregate coverage reports
        run: ./ci/combine_cov.sh

      - name: Upload coverage report
        uses: codecov/codecov-action@v3
        with:
          files: .coverage/coverage.xml
          name: "${{ matrix.NAME }}"
          fail_ci_if_error: false
          verbose: true