From 4612542b232a71a8e239b346f12fa807710a9441 Mon Sep 17 00:00:00 2001 From: n0099 Date: Tue, 13 Feb 2024 02:18:19 +0800 Subject: [PATCH] + workflows/be.yml + actions/be/action.yml @ .github --- .github/actions/be/action.yml | 31 ++++++++++++++++++++++++ .github/workflows/be.yml | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/actions/be/action.yml create mode 100644 .github/workflows/be.yml diff --git a/.github/actions/be/action.yml b/.github/actions/be/action.yml new file mode 100644 index 00000000..3d61be82 --- /dev/null +++ b/.github/actions/be/action.yml @@ -0,0 +1,31 @@ +name: be/init +description: be/init +runs: + using: composite + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + tools: composer cs2pr + coverage: none + ini-values: opcache.enable_cli=1 + env: + update: 'true' + - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + working-directory: be + shell: bash + - id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + working-directory: be + shell: bash + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - run: composer install --prefer-dist + working-directory: be + shell: bash diff --git a/.github/workflows/be.yml b/.github/workflows/be.yml new file mode 100644 index 00000000..d575f270 --- /dev/null +++ b/.github/workflows/be.yml @@ -0,0 +1,44 @@ +name: be +on: + push: + #paths: [be/**] +defaults: + run: + working-directory: be +jobs: + phpstan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - run: phpstan analyse + psalm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - run: psalm --output-format=github + php-cs-fixer: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr + phpcs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - id: run + run: phpcs --report-full --report-checkstyle=./phpcs-report.xml + - if: always() && steps.run.outcome == 'failure' + run: cs2pr ./phpcs-report.xml + pint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - id: run + run: pint --test + - if: failure() && steps.run.outcome != 'success' + run: pint --test --format=checkstyle | cs2pr