Skip to content

Commit

Permalink
build: reuse workflows (#7084)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Dec 29, 2023
1 parent 45c9f18 commit fb814fd
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 428 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/build_assets.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint files

on:
pull_request:
types: [opened, synchronize, reopened]

concurrency:
group: Lint files ${{ github.ref }}
cancel-in-progress: true

jobs:
php:
name: Lint PHP files
uses: monicahq/workflows/.github/workflows/lint_php.yml@main

vue:
name: Lint Vue files
uses: monicahq/workflows/.github/workflows/lint_vue.yml@main
with:
node-version: 18
41 changes: 0 additions & 41 deletions .github/workflows/lint_php.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/lint_vue.yml

This file was deleted.

44 changes: 3 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,16 @@ on:
env:
php-version: '8.2'
build-node-version: 18
semantic-node-version: 18

jobs:
####################
# Semantic release
####################
semantic:
runs-on: ubuntu-latest
name: Semantic release
if: github.event_name != 'pull_request'

outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Get all tags

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.semantic-node-version }}

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN_RELEASE: ${{ secrets.GH_TOKEN_RELEASE }}
with:
semantic_version: 19
extra_plugins: |
[email protected]
@semantic-release/changelog@6
- name: New release published
if: steps.semantic.outputs.new_release_published == 'true'
run: echo "### Release ${{ steps.semantic.outputs.new_release_version }} created :rocket:" >> $GITHUB_STEP_SUMMARY

- name: Store changelog file
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGELOG.md
uses: monicahq/workflows/.github/workflows/release.yml@main
with:
semantic_version: 19

package:
needs: semantic
Expand Down
71 changes: 4 additions & 67 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,7 @@ concurrency:
cancel-in-progress: true

jobs:
psalm:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
coverage: none
tools: psalm

# Composer
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer files
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Run psalm
run: vendor/bin/psalm --output-format=github

phpstan:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
coverage: none
tools: phpstan

# Composer
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer files
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Run phpstan
run: vendor/bin/phpstan analyse
statics:
uses: monicahq/workflows/.github/workflows/static.yml@main
with:
php-version: 8.2
Loading

0 comments on commit fb814fd

Please sign in to comment.