Skip to content

Commit

Permalink
Run tests using the ghcr.io/glpi-project/githubactions-glpi image
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Nov 3, 2023
1 parent 4eabb4e commit 9aa6ba5
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 58 deletions.
84 changes: 29 additions & 55 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,68 +11,37 @@ on:
workflow_dispatch:

jobs:
lint:
name: "Lint"
ci:
name: "GLPI ${{ matrix.glpi-version }} / php:${{ matrix.php-version }} / ${{ matrix.db-image }}"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
include:
- {php-version: "7.4"}
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
tools: "composer, cs2pr"
- name: "Get Composer cache directory"
id: "composer-cache"
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Restore dependencies cache"
uses: "actions/cache@v3"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ github.job }}-${{ matrix.php-version }}-dependencies-${{ hashFiles('**/composer.lock') }}"
- name: "Install Composer dependencies"
run: |
composer install --ansi --no-interaction --no-progress --prefer-dist
- name: "PHP Parallel Lint"
run: |
vendor/bin/parallel-lint --colors --checkstyle --exclude ./vendor/ . | cs2pr
- name: "PHP_CodeSniffer"
run: |
vendor/bin/phpcs -q --report=checkstyle | cs2pr
- name: "Check for missing/outdated headers"
run: |
vendor/bin/licence-headers-check --ansi --no-interaction
tests:
name: "Test on GLPI ${{ matrix.glpi-version }}"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
include:
- {glpi-version: "10.0", php-version: "7.4", db-image: "mysql:8.0"}
- {glpi-version: "10.0.x", php-version: "7.4", db-image: "mysql:5.7"}
- {glpi-version: "10.0.x", php-version: "8.0", db-image: "mysql:8.0"}
- {glpi-version: "10.0.x", php-version: "8.1", db-image: "mariadb:10.2"}
- {glpi-version: "10.0.x", php-version: "8.2", db-image: "mariadb:11.0"}
container:
image: "ghcr.io/glpi-project/githubactions-glpi:php-${{ matrix.php-version }}-glpi-${{ matrix.glpi-version }}"
options: >-
--volume ${{ github.workspace }}:/var/glpi/plugins:rw
services:
app:
image: "ghcr.io/glpi-project/githubactions-php:${{ matrix.php-version }}"
options: >-
--volume /glpi:/var/glpi:rw
db:
image: "ghcr.io/glpi-project/githubactions-${{ matrix.db-image }}"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_DATABASE: "glpi"
options: >-
--shm-size=1g
defaults:
run:
working-directory: "/var/glpi/plugins/oauthimap"
steps:
- name: "Checkout plugin"
- name: "Checkout"
uses: "actions/checkout@v4"
with:
path: "oauthimap"
- name: "Get Composer cache directory"
id: "composer-cache"
run: |
Expand All @@ -85,13 +54,18 @@ jobs:
- name: "Install Composer dependencies"
run: |
composer install --ansi --no-interaction --no-progress --prefer-dist
- name: "Deploy source into app container"
- name: "PHP Parallel Lint"
run: |
curl --silent https://nightly.glpi-project.org/glpi/${{ matrix.glpi-version }}.tar.gz | sudo tar --extract --ungzip --strip 1 --directory /glpi
sudo cp --no-target-directory --preserve --recursive `pwd` /glpi/plugins/oauthimap
sudo setfacl --recursive --modify u:1000:rwx /glpi
- name: "Install"
vendor/bin/parallel-lint --colors --checkstyle --exclude ./vendor/ . | vendor/bin/cs2pr
- name: "PHP_CodeSniffer"
run: |
vendor/bin/phpcs -q --report=checkstyle | vendor/bin/cs2pr
- name: "Check for missing/outdated headers"
run: |
vendor/bin/licence-headers-check --ansi --no-interaction
- name: "Install plugin"
working-directory: "/var/glpi"
run: |
docker exec ${{ job.services.app.id }} bin/console glpi:database:install --ansi --no-interaction --db-name=glpi --db-host=db --db-user=root --strict-configuration
docker exec ${{ job.services.app.id }} bin/console glpi:plugin:install --ansi --no-interaction --username=glpi oauthimap
docker exec ${{ job.services.app.id }} bin/console glpi:plugin:activate --ansi --no-interaction oauthimap
bin/console database:install --ansi --no-interaction --db-name=glpi --db-host=db --db-user=root --strict-configuration
bin/console plugin:install --ansi --no-interaction --username=glpi oauthimap
bin/console plugin:activate --ansi --no-interaction oauthimap
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"require-dev": {
"glpi-project/tools": "^0.6",
"php-parallel-lint/php-parallel-lint": "^1.3",
"squizlabs/php_codesniffer": "^3.6"
"squizlabs/php_codesniffer": "^3.6",
"staabm/annotate-pull-request-from-checkstyle": "^1.8"
},
"provide": {
"guzzlehttp/guzzle": "*"
Expand Down
56 changes: 54 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9aa6ba5

Please sign in to comment.