xref: /imagick/.github/workflows/main.yml (revision 388b7447)
1name: Tests
2
3on:
4  push:
5#    branches: [master]
6  pull_request:
7    types: [opened, synchronize, reopened]
8  release:
9    types: [created]
10
11jobs:
12
13  test_basic:
14    name: basic PHP ${{ matrix.php }} - I ${{ matrix.imagemagick }}
15    runs-on: ubuntu-20.04
16    strategy:
17      fail-fast: false
18      matrix:
19        os: [ ubuntu-latest ]
20        php: [ 5.4 ]
21        imagemagick: [
22            # 7.0.10-27,
23            # 6.9.2-0,
24            git7,
25            git6
26        ]
27#        exclude:
28#          - php: 5.4
29#            imagemagick: 6.8.7-0
30#        allow_failures:
31#         - imagemagick: git7
32#          - imagemagick: git6
33
34    steps:
35      - name: Checkout code
36        uses: actions/checkout@v2
37
38      - name: Setup PHP
39        uses: shivammathur/setup-php@v2
40        with:
41          php-version: ${{ matrix.php }}
42
43      - name: Apt install required packages
44        run: |
45          sudo apt-get update
46          sudo apt-get install -y fonts-urw-base35 || true
47          sudo apt-get install -y libfreetype6-dev || true
48          sudo apt-get install -y texlive-fonts-recommended || true
49
50      - name: Sanity check package.xml and install ImageMagick
51        run: |
52          for file in tests/*.phpt; do grep $(basename $file) package.xml >/dev/null || (echo "Missing $file from package.xml" ; exit 1); done
53          bash ./imagemagick_dependency.sh " ${{ matrix.imagemagick }}"
54
55      - name: Configure and check fonts are present
56        run: |
57          export NO_INTERACTION=1
58          export REPORT_EXIT_STATUS=1
59          export SKIP_SLOW_TESTS=1
60          export PHP_IMAGICK_VERSION=$(php -r '$sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;')
61          export CFLAGS=$(php util/calculate_cflags.php "${{ matrix.php }}" "${{ matrix.imagemagick }}")
62          echo "CFLAGS are ${CFLAGS}"
63          phpize
64          ./configure --with-imagick="${HOME}/im/imagemagick-${{ matrix.imagemagick }}"
65          sudo make install
66          php -d extension=imagick.so util/check_fonts.php
67
68      - name: Run Imagick tests
69        run: |
70          export TEST_PHP_EXECUTABLE=`which php`
71          php run-tests.php -d extension=imagick.so -d extension_dir=modules -n ./*.phpt --show-diff
72          php run-tests.php -d extension=imagick.so -d extension_dir=modules -n ./tests/*.phpt --show-diff
73          for i in `ls tests/*.diff 2>/dev/null`; do echo "-- START ${i}"; cat $i; echo "-- END"; done
74          php ./util/check_version.php
75
76
77  test_all:
78    name: Full PHP ${{ matrix.php }} - I ${{ matrix.imagemagick }}
79    needs: test_basic
80    runs-on: ubuntu-20.04
81    strategy:
82      fail-fast: false
83      matrix:
84        os: [ubuntu-latest]
85        php: [5.4, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5]
86        imagemagick: [
87          7.0.10-27,
88          7.0.8-4,
89          7.0.1-0,
90          git7,
91          6.9.2-0,
92          6.8.7-0,
93          6.7.8-0,
94          git6
95        ]
96        exclude:
97          - php: 5.4
98            imagemagick: 6.8.7-0
99        allow_failures:
100          - imagemagick: git7
101          - imagemagick: git6
102
103    steps:
104      - name: Checkout code
105        uses: actions/checkout@v2
106
107      - name: Setup PHP
108        uses: shivammathur/setup-php@v2
109        with:
110          php-version: ${{ matrix.php }}
111
112      - name: Apt install required packages
113        run: |
114          sudo apt-get update
115          sudo apt-get install -y fonts-urw-base35 || true
116          sudo apt-get install -y libfreetype6-dev || true
117          sudo apt-get install -y texlive-fonts-recommended || true
118
119      - name: Sanity check package.xml and install ImageMagick
120        run: |
121          for file in tests/*.phpt; do grep $(basename $file) package.xml >/dev/null || (echo "Missing $file from package.xml" ; exit 1); done
122          bash ./imagemagick_dependency.sh " ${{ matrix.imagemagick }}"
123
124      - name: Configure and check fonts are present
125        run: |
126          export NO_INTERACTION=1
127          export REPORT_EXIT_STATUS=1
128          export SKIP_SLOW_TESTS=1
129          export PHP_IMAGICK_VERSION=$(php -r '$sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;')
130          export CFLAGS=$(php util/calculate_cflags.php "${{ matrix.php }}" "${{ matrix.imagemagick }}")
131          echo "CFLAGS are ${CFLAGS}"
132          phpize
133          ./configure --with-imagick="${HOME}/im/imagemagick-${{ matrix.imagemagick }}"
134          sudo make install
135          php -d extension=imagick.so util/check_fonts.php
136
137      - name: Run Imagick tests
138        run: |
139          export TEST_PHP_EXECUTABLE=`which php`
140          php run-tests.php -d extension=imagick.so -d extension_dir=modules -n ./*.phpt --show-diff
141          php run-tests.php -d extension=imagick.so -d extension_dir=modules -n ./tests/*.phpt --show-diff
142          for i in `ls tests/*.diff 2>/dev/null`; do echo "-- START ${i}"; cat $i; echo "-- END"; done
143          php ./util/check_version.php
144
145