From 6563d4d0b90952b7ae32b388d66e16f257332b1d Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Wed, 17 Jan 2024 13:49:56 +0000 Subject: [PATCH] add goss (https://github.com/goss-org/goss) validation --- .github/workflows/docker.yml | 12 ++++ goss.yaml | 125 +++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 goss.yaml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 64978070..ea3533a3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -187,3 +187,15 @@ jobs: PHP_BASE_TYPE=${{ matrix.php_base }} cache-from: type=gha,scope=${{ matrix.target_runtime }}-${{ matrix.php_base }}-${{ matrix.php_version }} cache-to: type=gha,mode=max,scope=${{ matrix.target_runtime }}-${{ matrix.php_base }}-${{ matrix.php_version }} + + - uses: e1himself/goss-installation-action@v1 + with: + version: "v0.4.4" + + - name: Execute Goss tests + run: | + dgoss run \ + -v "./.env.testing:/var/www/.env" \ + -e EXPECTED_PHP_VERSION=${{ matrix.php_version }} \ + -e PHP_BASE_TYPE=${{ matrix.php_base }} \ + ${{ steps.meta.outputs.tags }} diff --git a/goss.yaml b/goss.yaml new file mode 100644 index 00000000..a43763b7 --- /dev/null +++ b/goss.yaml @@ -0,0 +1,125 @@ +# See: https://github.com/goss-org/goss/blob/master/docs/manual.md#goss-manual + +package: + curl: { installed: true } + ffmpeg: { installed: true } + gifsicle: { installed: true } + gosu: { installed: true } + jpegoptim: { installed: true } + locales-all: { installed: true } + locales: { installed: true } + mariadb-client: { installed: true } + nano: { installed: true } + optipng: { installed: true } + pngquant: { installed: true } + postgresql-client: { installed: true } + unzip: { installed: true } + wget: { installed: true } + zip: { installed: true } + +user: + www-data: + exists: true + uid: 33 + gid: 33 + groups: + - www-data + home: /var/www + shell: /usr/sbin/nologin + +command: + php-version: + exit-status: 0 + exec: 'php -v' + stdout: + - PHP {{ .Env.EXPECTED_PHP_VERSION }} + stderr: [] + + php-extensions: + exit-status: 0 + exec: 'php -m' + stdout: + - bcmath + - Core + - ctype + - curl + - date + - dom + - exif + - fileinfo + - filter + - ftp + - gd + - hash + - iconv + - imagick + - intl + - json + - libxml + - mbstring + - mysqlnd + - openssl + - pcntl + - pcre + - PDO + - pdo_mysql + - pdo_pgsql + - pdo_sqlite + - Phar + - posix + - random + - readline + - redis + - Reflection + - session + - SimpleXML + - sodium + - SPL + - sqlite3 + - standard + - tokenizer + - xml + - xmlreader + - xmlwriter + - zip + - zlib + stderr: [] + + forego-version: + exit-status: 0 + exec: 'forego version' + stdout: + - dev + stderr: [] + + gomplate-version: + exit-status: 0 + exec: 'gomplate -v' + stdout: + - gomplate version + stderr: [] + + gosu-version: + exit-status: 0 + exec: 'gosu -v' + stdout: + - '1.12' + stderr: [] + +{{ if eq .Env.PHP_BASE_TYPE "nginx" }} + nginx-version: + exit-status: 0 + exec: 'nginx -v' + stdout: [] + stderr: + - 'nginx version: nginx' +{{ end }} + +{{ if eq .Env.PHP_BASE_TYPE "apache" }} + nginx-version: + exit-status: 0 + exec: 'apachectl -v' + stdout: + - 'Server version: Apache/' + stderr: [] +{{ end }}