Skip to content

Merge pull request #255 from gordalina/dependabot/composer/symfony/ht… #433

Merge pull request #255 from gordalina/dependabot/composer/symfony/ht…

Merge pull request #255 from gordalina/dependabot/composer/symfony/ht… #433

Workflow file for this run

name: ci
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
jobs:
test:
runs-on: ${{ matrix.operating-system }}
continue-on-error: ${{ matrix.allow-failure }}
strategy:
max-parallel: 15
matrix:
operating-system: [ubuntu-22.04, macos-12]
php-version: ["8.1", "8.2"]
allow-failure: [false]
include:
- php-version: 8.3
operating-system: ubuntu-22.04
allow-failure: true
- php-version: 8.3
operating-system: macos-12
allow-failure: true
- php-version: 8.3
operating-system: macos-13
allow-failure: true
name: Test PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-version }}
extensions: apcu, mbstring, pcov
ini-values: apc.enabled=1, apc.enable_cli=1, opcache.enable=1, opcache.enable_cli=1, opcache.jit=disable
coverage: pcov
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
- name: Install Dependencies
if: ${{ !matrix.allow-failure }}
run: composer install --prefer-dist
- name: Install Dependencies (ignoring platform requirements)
if: ${{ matrix.allow-failure }}
run: composer install --prefer-dist --ignore-platform-req=php+
- name: Run test suite
run: $(composer config bin-dir)/phpunit --coverage-clover=coverage.clover
- name: Upload coverage to coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
php php-coveralls.phar --coverage_clover=coverage.clover --json_path=coveralls-upload.json -v
release:
runs-on: ubuntu-22.04
name: Create & Publish Release
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get tag & commit hash
id: info
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: cachetool
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: 8.2
- name: Install Dependencies
run: |
composer global config minimum-stability dev
composer global config prefer-stable true
composer global require humbug/box
composer install --prefer-dist --no-dev
- name: Create Release Assets
run: |
jq '. + {compression: "GZ", output: "cachetool.phar.gz"}' box.json > box.gz.json
jq '. + {compression: "BZ2", output: "cachetool.phar.bz2"}' box.json > box.bz2.json
$(composer config home)/vendor/bin/box compile --config=box.json
$(composer config home)/vendor/bin/box compile --config=box.gz.json
$(composer config home)/vendor/bin/box compile --config=box.bz2.json
- name: Build & tag images (${{ steps.info.outputs.VERSION }} and latest)
if: ${{ !contains(github.ref, '-') }}
uses: docker/build-push-action@v3
with:
build-args: |
BUILD_DATE=${{ steps.info.outputs.BUILD_DATE }}
CACHETOOL_VERSION=${{ steps.info.outputs.VERSION }}
COMMIT_SHA=${{ steps.info.outputs.COMMIT_SHA }}
PHP_VERSION=8.1
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
gordalina/cachetool:latest
gordalina/cachetool:${{ steps.info.outputs.VERSION }}
ghcr.io/gordalina/cachetool:latest
ghcr.io/gordalina/cachetool:${{ steps.info.outputs.VERSION }}
- name: Build & tag images (${{ steps.info.outputs.VERSION }})
if: ${{ contains(github.ref, '-') }}
uses: docker/build-push-action@v3
with:
build-args: |
BUILD_DATE=${{ steps.info.outputs.BUILD_DATE }}
CACHETOOL_VERSION=${{ steps.info.outputs.VERSION }}
COMMIT_SHA=${{ steps.info.outputs.COMMIT_SHA }}
PHP_VERSION=8.1
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
gordalina/cachetool:${{ steps.info.outputs.VERSION }}
ghcr.io/gordalina/cachetool:${{ steps.info.outputs.VERSION }}
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ steps.info.outputs.VERSION }}
tag_name: ${{ steps.info.outputs.VERSION }}
draft: false
prerelease: ${{ contains(github.ref, '-') }}
files: |
cachetool.phar
cachetool.phar.gz
cachetool.phar.bz2
CHANGELOG.md
LICENSE
body: |
## Changelog
The full changelog can be found in our [changelog file](https://github.com/gordalina/cachetool/blob/${{ steps.info.outputs.VERSION }}/CHANGELOG.md)
- name: Update GitHub Pages
if: ${{ !contains(github.ref, '-') }}
run: |
REF="${{ github.ref }}"
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
bin/update-gh-pages.sh ${{ steps.info.outputs.VERSION }}