summaryrefslogtreecommitdiff
path: root/azure/community_job.yml
blob: a3b2afc47500971e686a4da29eca3e881d398862 (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
parameters:
  configurationName: ''
  configurationParameters: ''
  timeoutInMinutes: 60

# The purpose of the job is to test open-source community projects against an aggressive
# debug build, that enables assertions, as well as the address and UB sanitizers. However,
# we are only interested in finding assertion failures, segfaults and sanitizer violations,
# and don't care about the actual test results, as there will commonly be failures for
# pre-release versions of PHP.
#
# Because exit() in PHP results in an unclean shutdown, test runs are patching phpunit to
# avoid the exit, which allows us to also check for memory leaks. Otherwise we use
# USE_TRACKED_ALLOC=1 to avoid reporting of leaks that will be handled by ZMM.
jobs:
  - job: ${{ parameters.configurationName }}
    timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
    pool:
      vmImage: 'ubuntu-18.04'
    variables:
      ubsan_options: 'print_stacktrace=1'
    steps:
    - template: apt.yml
    - script: |
        # Compile a newer version of curl, otherwise there will be an asan warning
        # when running symfony tests.
        wget https://curl.haxx.se/download/curl-7.65.3.tar.gz
        tar xzf curl-7.65.3.tar.gz
        cd curl-7.65.3/
        ./configure
        make -j2
        sudo make install
      displayName: 'Build Curl'
    - template: configure.yml
      parameters:
        configurationParameters: ${{ parameters.configurationParameters }}
    - script: make -j$(/usr/bin/nproc) >/dev/null
      displayName: 'Make Build'
    - script: |
        sudo make install
        sudo mkdir     /etc/php.d
        sudo chmod 777 /etc/php.d
        echo mysqli.default_socket=/var/run/mysqld/mysqld.sock     > /etc/php.d/mysqli.ini
        echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock  > /etc/php.d/pdo_mysql.ini
        # Run with opcache to also catch optimizer bugs.
        echo zend_extension=opcache.so > /etc/php.d/opcache.ini
        echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
        echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
        echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
      displayName: 'Install Build'
    - script: |
        git clone https://github.com/laravel/framework.git --branch=master --depth=1
        cd framework
        php7.4 /usr/bin/composer install --no-progress
        # Hack to disable a test that hangs on azure
        sed -i 's/PHP_OS/"Darwin"/' tests/Filesystem/FilesystemTest.php
        export USE_ZEND_ALLOC=0
        export ASAN_OPTIONS=exitcode=139
        php vendor/bin/phpunit
        if [ $? -gt 128 ]; then
          exit 1
        fi
      displayName: 'Test Laravel'
    - script: |
        git clone https://github.com/symfony/symfony.git --depth=1
        cd symfony
        php7.4 /usr/bin/composer install --no-progress
        php7.4 ./phpunit install
        export USE_ZEND_ALLOC=0
        export USE_TRACKED_ALLOC=1
        export ASAN_OPTIONS=exitcode=139
        export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
        X=0
        for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
          php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient;
          if [ $? -gt 128 ]; then
            X=1;
          fi
        done
        exit $X
      displayName: 'Test Symfony'
      condition: or(succeeded(), failed())
    - script: |
        git clone https://github.com/amphp/amp.git --branch=master --depth=1
        cd amp
        php /usr/bin/composer install --no-progress --ignore-platform-reqs
        export USE_ZEND_ALLOC=0
        sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php
        php vendor/bin/phpunit
      displayName: 'Test Amphp'
      condition: or(succeeded(), failed())
    - script: |
        git clone https://github.com/sebastianbergmann/phpunit.git --branch=master --depth=1
        cd phpunit
        export USE_ZEND_ALLOC=0
        export USE_TRACKED_ALLOC=1
        export ASAN_OPTIONS=exitcode=139
        php7.4 /usr/bin/composer install --no-progress
        php ./phpunit
        if [ $? -gt 128 ]; then
          exit 1
        fi
      displayName: 'Test PHPUnit'
    - script: |
        php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
        cd symfony_demo
        export USE_ZEND_ALLOC=0
        export USE_TRACKED_ALLOC=1
        sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
        php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php
      displayName: 'Symfony Preloading'
      condition: or(succeeded(), failed())