ci: update workflows (#6987)

This commit is contained in:
Alexis Saettler
2023-10-30 23:58:28 +01:00
committed by GitHub
parent 24b52d2c7e
commit 6454c97e7a
6 changed files with 28 additions and 45 deletions
+1 -13
View File
@@ -3,8 +3,6 @@ name: Build assets
on:
pull_request:
types: [opened, synchronize, reopened]
release:
types: [created]
env:
node-version: 18
@@ -27,23 +25,13 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
# Yarn
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Cache yarn files
uses: actions/cache@v3
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-v2-
cache: yarn
- name: Install yarn dependencies
run: yarn install --immutable
- name: Build assets
+14 -3
View File
@@ -4,6 +4,10 @@ on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
release:
types: [published]
workflow_dispatch:
@@ -34,7 +38,13 @@ jobs:
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.package-name }}
tags: |
type=sha
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.description="This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you."
org.opencontainers.image.title="MonicaHQ, the Personal Relationship Manager"
@@ -59,13 +69,13 @@ jobs:
id: docker_build
uses: docker/build-push-action@v5
with:
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ env.package-name }}:main
labels: ${{ steps.docker_meta.outputs.labels }}
file: scripts/docker/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
platforms: ${{ (github.event_name != 'pull_request') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=This is MonicaHQ your personal memory! MonicaHQ is like a CRM but for the friends family and acquaintances around you.
- name: Image digest
@@ -73,6 +83,7 @@ jobs:
- name: Prune images
uses: vlaurin/action-ghcr-prune@v0.5.0
if: github.event_name != 'pull_request'
with:
token: ${{ secrets.CR_PAT }}
organization: ${{ github.repository_owner }}
+1 -9
View File
@@ -28,15 +28,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Cache yarn files
uses: actions/cache@v3
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-v2-
cache: yarn
- name: Install yarn dependencies
run: yarn install --immutable
+1 -8
View File
@@ -105,14 +105,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.build-node-version }}
- name: Cache yarn files
uses: actions/cache@v3
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-v2-
cache: yarn
- name: Import key
run: echo -e "$GPG_KEY" | gpg --batch --yes --import -
+2
View File
@@ -24,6 +24,7 @@ jobs:
with:
php-version: ${{ env.php-version }}
coverage: none
tools: psalm
# Composer
- name: Get Composer Cache Directory
@@ -57,6 +58,7 @@ jobs:
with:
php-version: ${{ env.php-version }}
coverage: none
tools: phpstan
# Composer
- name: Get Composer Cache Directory
+9 -12
View File
@@ -37,27 +37,22 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php-version }} without coverage
if: matrix.connection != env.coverage-with || matrix.php-version != env.default-php-version || ! matrix.coverage
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom, fileinfo, ${{ matrix.connection }}
coverage: none
- name: Setup PHP ${{ matrix.php-version }}
if: matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom, fileinfo, ${{ matrix.connection }}
coverage: pcov
ini-values: pcov.directory=., pcov.exclude="~vendor~"
coverage: ${{ (matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage) && 'pcov' || 'none' }}
ini-values: ${{ (matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage) && 'pcov.directory=., pcov.exclude="~vendor~"' || '' }}
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
# Composer
- name: Validate composer.json and composer.lock
@@ -119,13 +114,15 @@ jobs:
run: php artisan db:seed --no-interaction -vvv
# Test
- name: Run tests suite with coverage
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run tests with coverage
if: matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage
run: vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage${{ matrix.testsuite }}.xml
env:
DB_CONNECTION: ${{ matrix.connection }}
- name: Run tests
if: matrix.connection != env.coverage-with || matrix.php-version != env.default-php-version || ! matrix.coverage
if: ${{ ! (matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage) }}
run: vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml
env:
DB_CONNECTION: ${{ matrix.connection }}