|
29 | 29 | paths: |
30 | 30 | - '**.php' |
31 | 31 | - '.github/workflows/**' |
32 | | - - 'composer.json' |
33 | | - - 'composer.lock' |
34 | 32 | - 'phpunit.xml.dist' |
35 | 33 | - 'tests/**' |
36 | 34 | pull_request: |
|
40 | 38 | paths: |
41 | 39 | - '**.php' |
42 | 40 | - '.github/workflows/**' |
43 | | - - 'composer.json' |
44 | | - - 'composer.lock' |
45 | 41 | - 'phpunit.xml.dist' |
46 | 42 | - 'tests/**' |
47 | 43 | workflow_dispatch: |
@@ -72,29 +68,47 @@ jobs: |
72 | 68 | args: -color |
73 | 69 |
|
74 | 70 | unit-test: |
75 | | - name: Standalone test suite |
| 71 | + name: Pest using Cacti Composer (Docker) |
76 | 72 | runs-on: ubuntu-latest |
| 73 | + timeout-minutes: 20 |
| 74 | + |
77 | 75 | steps: |
78 | 76 | - name: Checkout monitor Plugin |
79 | | - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 |
| 77 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
80 | 78 |
|
81 | | - - name: Install PHP |
82 | | - uses: shivammathur/setup-php@b604ade2a87db23f8871b7182e69ec5e75effb45 # v2 |
| 79 | + - name: Checkout Cacti runtime |
| 80 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
83 | 81 | with: |
84 | | - # 8.2 is the floor for the test tooling, not for the plugin: Pest 2 pulls |
85 | | - # brianium/paratest ^7.4, which requires 8.2. The plugin's own floor is |
86 | | - # covered by syntax-floor on 8.0 and by the 8.1 integration matrix entry. |
87 | | - php-version: '8.2' |
88 | | - tools: composer |
| 82 | + repository: Cacti/cacti |
| 83 | + # Commit behind the annotated release/1.2.31 tag. |
| 84 | + ref: 1e8eaca26b84b128c39ce8cc8ece42d7ff76aac1 |
| 85 | + path: cacti-runtime |
89 | 86 |
|
90 | | - - name: Install dev dependencies |
91 | | - run: composer install --prefer-dist --no-progress --no-interaction --no-plugins --no-scripts |
| 87 | + - name: Checkout Cacti test toolchain |
| 88 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 89 | + with: |
| 90 | + repository: Cacti/cacti |
| 91 | + # Pins Composer, Pest, the lock file and Cacti's Docker test image. |
| 92 | + ref: 298bd51eca843490fb90b27ada6b3fecc9b9a7d8 |
| 93 | + path: cacti-toolchain |
| 94 | + |
| 95 | + # The same image Cacti's own tests/tools/docker_pest.sh builds. Composer and |
| 96 | + # Pest come from Cacti's locked toolchain, so the plugin ships no |
| 97 | + # composer.json and no parallel vendor directory. |
| 98 | + - name: Build Cacti test image |
| 99 | + run: | |
| 100 | + docker build --tag cacti-web --file cacti-toolchain/docker/Dockerfile cacti-toolchain/docker |
| 101 | + docker build --tag cacti-monitor-test --file cacti-toolchain/docker/Dockerfile.test cacti-toolchain |
92 | 102 |
|
93 | | - - name: Run the test suite |
94 | | - run: composer test |
| 103 | + - name: Run Pest |
| 104 | + run: | |
| 105 | + docker run --rm \ |
| 106 | + --volume "$PWD/cacti-runtime":/cacti \ |
| 107 | + --volume "$PWD":/cacti/plugins/monitor \ |
| 108 | + --user root \ |
| 109 | + --entrypoint composer cacti-monitor-test \ |
| 110 | + test -- --configuration=/cacti/plugins/monitor/phpunit.xml.dist |
95 | 111 |
|
96 | | - # compat = 1.2.15 implies Cacti 1.2.x, which requires PHP 8.0. The matrix |
97 | | - # below starts at 8.1, so it cannot catch syntax the declared floor rejects. |
98 | 112 | syntax-floor: |
99 | 113 | name: PHP 8.0 syntax floor |
100 | 114 | runs-on: ubuntu-latest |
|
0 commit comments