@@ -37,53 +37,79 @@ jobs:
3737 - name : Run tests
3838 run : composer run phpunit -- --no-coverage
3939
40- # This does not work
41- # behat:
42- # name: Tests (Behat with PHP ${{ matrix.php }})
43- # runs-on: ubuntu-latest
44-
45- # services:
46- # redmine-6-0:
47- # image: redmine:6.0.7
48- # ports:
49- # - "5060:3000"
50- # env:
51- # # Workaround: Remove secret for Rails 7.2 so it will be generated automatically
52- # # @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932
53- # # REDMINE_SECRET_KEY_BASE: supersecretkey
54- # REDMINE_PLUGINS_MIGRATE: true
55- # volumes:
56- # - /home/runner/work/_temp/redmine-60007_data/files:/usr/src/redmine/files
57- # - /home/runner/work/_temp/redmine-60007_data/sqlite:/usr/src/redmine/sqlite
58- # options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-start-period=30s --health-interval=30s --health-timeout=30s --health-retries=3
59-
60- # strategy:
61- # fail-fast: false
62- # matrix:
63- # operating-system: ["ubuntu-latest"]
64- # php: ["8.3"]
65-
66- # steps:
67- # - name: Checkout
68- # uses: actions/checkout@v4
69- # with:
70- # fetch-depth: 2
71-
72- # - name: Setup PHP, with composer and extensions
73- # uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
74- # with:
75- # php-version: ${{ matrix.php }}
76- # tools: phpunit
77- # extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
78- # coverage: xdebug
79-
80- # # Install composer dependencies and handle caching in one go.
81- # # @link https://github.com/marketplace/actions/install-composer-dependencies
82- # - name: "Install Composer dependencies"
83- # uses: "ramsey/composer-install@v2"
84-
85- # - name: Run behat
86- # run: vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --suite=redmine_6_0
40+ behat :
41+ name : Behat ${{ matrix.suite }} (PHP ${{ matrix.php }})
42+ runs-on : ubuntu-latest
43+ permissions :
44+ contents : read
45+
46+ strategy :
47+ fail-fast : false
48+ matrix :
49+ php : ["8.3"]
50+ suite : [redmine_6_1, redmine_6_0, redmine_5_1]
51+ include :
52+ - suite : redmine_6_1
53+ service : redmine-6-1
54+ port : 5061
55+ data-dir : redmine-60101_data
56+ - suite : redmine_6_0
57+ service : redmine-6-0
58+ port : 5060
59+ data-dir : redmine-60008_data
60+ - suite : redmine_5_1
61+ service : redmine-5-1
62+ port : 5051
63+ data-dir : redmine-50111_data
64+
65+ steps :
66+ - name : Checkout
67+ uses : actions/checkout@v4
68+ with :
69+ fetch-depth : 2
70+
71+ - name : Setup PHP, with composer and extensions
72+ uses : shivammathur/setup-php@v2
73+ with :
74+ php-version : ${{ matrix.php }}
75+ tools : phpunit
76+ extensions : mbstring, xml, ctype, iconv, intl, pdo_sqlite, curl
77+ coverage : xdebug
78+
79+ - name : Install Composer dependencies
80+ uses : ramsey/composer-install@v2
81+
82+ - name : Create data directory
83+ run : |
84+ mkdir -p .docker/${{ matrix.data-dir }}/{files,sqlite}
85+ chmod -R 777 .docker/${{ matrix.data-dir }}/
86+
87+ - name : Start Redmine container
88+ run : docker compose up -d ${{ matrix.service }}
89+
90+ - name : Wait for Redmine to be healthy
91+ run : |
92+ for i in $(seq 1 60); do
93+ if curl -sf http://localhost:${{ matrix.port }} > /dev/null 2>&1; then
94+ echo "Redmine ${{ matrix.service }} is ready"
95+ exit 0
96+ fi
97+ echo "Waiting... ($i/60)"
98+ sleep 5
99+ done
100+ echo "Redmine ${{ matrix.service }} did not become ready"
101+ docker compose logs ${{ matrix.service }}
102+ exit 1
103+
104+ - name : Fix permissions
105+ run : sudo chmod -R 777 .docker/${{ matrix.data-dir }}/
106+
107+ - name : Run behat
108+ run : vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --format=progress --suite=${{ matrix.suite }}
109+
110+ - name : Cleanup
111+ if : always()
112+ run : docker compose down -v
87113
88114 code-quality :
89115 name : Check ${{ matrix.tool }} (PHP ${{ matrix.php }})
0 commit comments