mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-05-25 12:44:55 +00:00
Update workflows
This commit is contained in:
128
.github/workflows/check.yaml
vendored
Normal file
128
.github/workflows/check.yaml
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
name: Check
|
||||
|
||||
# Run this workflow every time a new commit pushed to your repository
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'public/build/*.js'
|
||||
- 'public/build/**/*.js'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'public/build/*.js'
|
||||
- 'public/build/**/*.js'
|
||||
# Allow manually triggering the workflow.
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
kill_previous:
|
||||
name: 0️⃣ Kill previous runs
|
||||
runs-on: ubuntu-latest
|
||||
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch.
|
||||
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.12.1
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
php_syntax_errors:
|
||||
name: 1️⃣ PHP Code Style errors
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- kill_previous
|
||||
steps:
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.2
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ramsey/composer-install@v2
|
||||
|
||||
- name: Check source code for syntax errors
|
||||
run: ./vendor/bin/pint --test
|
||||
|
||||
tests:
|
||||
name: 2️⃣ PHP ${{ matrix.php-version }} Tests
|
||||
needs:
|
||||
- php_syntax_errors
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- 8.2
|
||||
- 8.3
|
||||
env:
|
||||
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP Action
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
extensions: ${{ env.extensions }}
|
||||
coverage: xdebug
|
||||
tools: pecl, composer
|
||||
|
||||
- name: Install Composer dependencies
|
||||
uses: ramsey/composer-install@v2
|
||||
|
||||
- name: Apply tests ${{ matrix.php-version }}
|
||||
run: php artisan test
|
||||
|
||||
createReleaseFile:
|
||||
name: 3️⃣ Build / Upload - Release File
|
||||
if: github.ref_type == 'tag'
|
||||
needs:
|
||||
- tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.2
|
||||
extensions: ${{ env.extensions }}
|
||||
coverage: none
|
||||
|
||||
- name: Install Composer dependencies
|
||||
uses: ramsey/composer-install@v2
|
||||
with:
|
||||
composer-options: --no-dev
|
||||
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install
|
||||
run: npm install
|
||||
|
||||
- name: Compile Front-end
|
||||
run: npm run build
|
||||
|
||||
- name: Build Dist
|
||||
run: |
|
||||
make clean dist
|
||||
|
||||
- name: Upload package
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ github.token }}
|
||||
file: InvoiceShelf.zip
|
||||
asset_name: InvoiceShelf.zip
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
88
.github/workflows/ci.yaml
vendored
88
.github/workflows/ci.yaml
vendored
@@ -1,88 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- "*"
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
env:
|
||||
INVOICESHELF_VERSION: 1.0.0-beta3
|
||||
jobs:
|
||||
build-test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['8.1', '8.2']
|
||||
|
||||
name: PHP ${{ matrix.php }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: exif
|
||||
|
||||
- name: Install PHP dependencies
|
||||
run: composer update --ignore-platform-req=php --no-interaction --no-progress
|
||||
|
||||
- name: Check coding style
|
||||
run: ./vendor/bin/pint --test
|
||||
|
||||
- name: Unit Tests
|
||||
run: php ./vendor/bin/pest
|
||||
docker:
|
||||
if: ${{ needs.build-test.result == 'success' && github.event_name != 'pull_request'}}
|
||||
name: Docker build and publish
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-test
|
||||
steps:
|
||||
- name: derive version tag
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" =~ ^refs/tags* ]]; then
|
||||
GITHUB_TAG=${GITHUB_REF#refs/tags/}
|
||||
echo "running for a release $GITHUB_TAG"
|
||||
if [ "$GITHUB_TAG" != "${{ env.INVOICESHELF_VERSION }}" ]; then
|
||||
echo "tag $GITHUB_TAG pushed does not match with INVOICESHELF_VERSION ${{ env.INVOICESHELF_VERSION }} in .github/worlflows/ci. Please push correct release tag"
|
||||
exit 1
|
||||
fi
|
||||
echo "VERSION_TAG=${{ env.INVOICESHELF_VERSION }}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "running for a master commit"
|
||||
if [ $(git tag -l ${{ env.INVOICESHELF_VERSION }}) ]; then
|
||||
echo "Version ${{ env.INVOICESHELF_VERSION }} already released. Please update your version in .github/worlflows/ci"
|
||||
exit 1
|
||||
fi
|
||||
echo "VERSION_TAG=${{ env.INVOICESHELF_VERSION }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
- name: Docker Build and push invoiceshelf-php
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
file: docker/Dockerfile
|
||||
push: true
|
||||
tags: invoiceshelf/invoiceshelf-php:${{env.VERSION_TAG}},invoiceshelf/invoiceshelf-php:latest
|
||||
- name: Docker Build and push invoiceshelf-nginx
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
file: docker/nginx.Dockerfile
|
||||
push: true
|
||||
tags: invoiceshelf/invoiceshelf-nginx:${{env.VERSION_TAG}},invoiceshelf/invoiceshelf-nginx:latest
|
||||
71
Makefile
Normal file
71
Makefile
Normal file
@@ -0,0 +1,71 @@
|
||||
.PHONY: dist-gen dist-clean dist clean test
|
||||
|
||||
composer:
|
||||
rm -r vendor 2> /dev/null || true
|
||||
composer install --prefer-dist --no-dev
|
||||
|
||||
npm-build:
|
||||
rm -r public/build 2> /dev/null || true
|
||||
rm -r node_modules 2> /dev/null || true
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
dist-gen: clean composer npm-build
|
||||
@echo "packaging..."
|
||||
@mkdir InvoiceShelf
|
||||
@mkdir InvoiceShelf/public
|
||||
@cp -r app InvoiceShelf
|
||||
@cp -r bootstrap InvoiceShelf
|
||||
@cp -r config InvoiceShelf
|
||||
@cp -r database InvoiceShelf
|
||||
@cp -r public/build InvoiceShelf/public
|
||||
@cp -r public/favicons InvoiceShelf/public
|
||||
@cp -r public/.htaccess InvoiceShelf/public
|
||||
@cp -r public/index.php InvoiceShelf/public
|
||||
@cp -r public/robots.txt InvoiceShelf/public
|
||||
@cp -r public/web.config InvoiceShelf/public
|
||||
@cp -r resources InvoiceShelf
|
||||
@cp -r routes InvoiceShelf
|
||||
@cp -r storage InvoiceShelf
|
||||
@cp -r vendor InvoiceShelf 2> /dev/null || true
|
||||
@cp -r .env.example InvoiceShelf
|
||||
@cp -r artisan InvoiceShelf
|
||||
@cp -r composer.json InvoiceShelf
|
||||
@cp -r composer.lock InvoiceShelf
|
||||
@cp -r server.php InvoiceShelf
|
||||
@cp -r LICENSE InvoiceShelf
|
||||
@cp -r readme.md InvoiceShelf
|
||||
@cp -r SECURITY.md InvoiceShelf
|
||||
@touch InvoiceShelf/storage/logs/laravel.log
|
||||
|
||||
dist-clean: dist-gen
|
||||
find InvoiceShelf -wholename '*/[Tt]ests/*' -delete
|
||||
find InvoiceShelf -wholename '*/[Tt]est/*' -delete
|
||||
@rm -r InvoiceShelf/storage/framework/cache/data/* 2> /dev/null || true
|
||||
@rm InvoiceShelf/storage/framework/sessions/* 2> /dev/null || true
|
||||
@rm InvoiceShelf/storage/framework/views/* 2> /dev/null || true
|
||||
@rm InvoiceShelf/storage/logs/* 2> /dev/null || true
|
||||
|
||||
dist: dist-clean
|
||||
@zip -r InvoiceShelf.zip InvoiceShelf
|
||||
|
||||
clean:
|
||||
@rm build/* 2> /dev/null || true
|
||||
@rm -r InvoiceShelf 2> /dev/null || true
|
||||
@rm -r public/build 2> /dev/null || true
|
||||
@rm -r node_modules 2> /dev/null || true
|
||||
@rm -r vendor 2> /dev/null || true
|
||||
|
||||
install: composer npm-build
|
||||
php artisan migrate
|
||||
|
||||
test:
|
||||
@if [ -x "vendor/bin/pest" ]; then \
|
||||
./vendor/bin/pest --stop-on-failure; \
|
||||
else \
|
||||
echo ""; \
|
||||
echo "Please install pest:"; \
|
||||
echo ""; \
|
||||
echo " composer install"; \
|
||||
echo ""; \
|
||||
fi
|
||||
Reference in New Issue
Block a user