From 6f3331c5190bf7db9ed27828ce138e8ee4988025 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 | 50 +++++++++++++++++++++++++++++++++++ .github/workflows/c#.yml | 3 +-- 3 files changed, 82 insertions(+), 2 deletions(-) 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..1957f8de --- /dev/null +++ b/.github/workflows/be.yml @@ -0,0 +1,50 @@ +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: ./vendor/bin/phpstan analyse + psalm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - run: ./vendor/bin/psalm --output-format=github + phpcs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - id: run + run: ./vendor/bin/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: ./vendor/bin/pint --test + - if: failure() && steps.run.outcome != 'success' + run: ./vendor/bin/pint --test --format=checkstyle | cs2pr + php-cs-fixer: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - run: ./vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr + phpmd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/be + - run: ./vendor/bin/phpmd . github diff --git a/.github/workflows/c#.yml b/.github/workflows/c#.yml index 84fccdd7..82973276 100644 --- a/.github/workflows/c#.yml +++ b/.github/workflows/c#.yml @@ -14,5 +14,4 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/c# - - name: build - run: dotnet build --no-restore -c Debug ${{ matrix.project }} + - run: dotnet build --no-restore -c Debug ${{ matrix.project }}