Skip to content

Merge branch 'master' into releases/1.0 #88

Merge branch 'master' into releases/1.0

Merge branch 'master' into releases/1.0 #88

Workflow file for this run

name: CI-CD
on:
push:
branches:
- "master"
- "releases/**"
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request: ~
env:
DOCKER_BUILDKIT: 1
jobs:
quality:
name: Quality
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.2' ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: "json,openssl,mbstring,xml,ctype,iconv,intl"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php }}"
tools: composer:v2, flex
- name: Determine composer cache directory
id: composer-cache
run: echo "::set-output name=directory::$(composer config cache-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-
- name: Install Composer dependencies
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --ansi
- name: Quality
run: |
vendor/bin/psalm
vendor/bin/phpcs
images:
runs-on: ubuntu-latest
needs: quality
if: github.event_name == 'push' && github.repository == 'aulasoftwarelibre/lock' && (startsWith(github.ref, 'refs/heads/releases/') || startsWith(github.ref, 'refs/tags/v') )
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
-
name: Extract tag name
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF##*/})"
-
name: Build and push php
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
target: lock_php
tags: |
ghcr.io/aulasoftwarelibre/lock-php:latest
ghcr.io/aulasoftwarelibre/lock-php:${{ steps.extract_tag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
-
name: Build and push httpd
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
target: lock_httpd
tags: |
ghcr.io/aulasoftwarelibre/lock-httpd:latest
ghcr.io/aulasoftwarelibre/lock-httpd:${{ steps.extract_tag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max