Skip to content

Commit

Permalink
* move multiple values of runs-on into matrix.runs-on following h…
Browse files Browse the repository at this point in the history
  • Loading branch information
n0099 committed Jun 13, 2024
1 parent 61895d1 commit 92f1dc2
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 123 deletions.
59 changes: 59 additions & 0 deletions .github/baseflows/be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: be
on:
workflow_call:
inputs:
runs-on:
required: true
type: string
defaults:
run:
working-directory: be
jobs:
phpstan:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: ./vendor/bin/phpstan analyse --error-format=github

psalm:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: ./vendor/bin/psalm --output-format=github

phpcs:
runs-on: ${{ inputs.runs-on }}
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

# https://github.com/staabm/annotate-pull-request-from-checkstyle
pint:
runs-on: ${{ inputs.runs-on }}
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: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: ./vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle . | cs2pr

phpmd:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: ./vendor/bin/phpmd . github cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor # https://github.com/phpmd/phpmd/issues/506
57 changes: 57 additions & 0 deletions .github/baseflows/c#.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: c#
on:
workflow_call:
inputs:
runs-on:
required: true
type: string
defaults:
run:
working-directory: c#
jobs:
build:
runs-on: ${{ inputs.runs-on }}
strategy:
matrix:
project: [crawler, imagePipeline, shared, tbClient]
fail-fast: false
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/c#
- run: dotnet build --no-restore -c Release ${{ matrix.project }}

ReSharper:
runs-on: ${{ inputs.runs-on }}
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/c#

- id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
${{ github.workspace }}/.resharper
~/.dotnet/tools
key: ${{ runner.os }}-resharper
restore-keys: ${{ runner.os }}-resharper-

- uses: muno92/resharper_inspectcode@v1
with:
version: 2024.*
minimumReportSeverity: info
minimumSeverity: warning
solutionPath: c#/tbm.sln
cachesHome: ${{ github.workspace }}/.resharper

# https://github.com/actions/runner/issues/1478
- uses: actions/cache/save@v4
if: always() && steps.cache-restore.outputs.cache-hit != 'true'
with:
path: |
${{ github.workspace }}/.resharper
~/.dotnet/tools
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
35 changes: 35 additions & 0 deletions .github/baseflows/fe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: fe
on:
workflow_call:
inputs:
runs-on:
required: true
type: string
defaults:
run:
working-directory: fe
jobs:
tsc:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fe
- run: yarn run vue-tsc

eslint:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fe
- run: yarn run eslint src

codechecks:
runs-on: ${{ inputs.runs-on }}
steps: # contains CVE that triggers Dependabot
- uses: actions/checkout@v4
- uses: ./.github/actions/fe
- run: |
yarn add -D typecov @codechecks/client
yarn run codechecks ../.github/codechecks.yml
env:
CC_SECRET: ${{ secrets.CC_SECRET }}
60 changes: 9 additions & 51 deletions .github/workflows/be.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,14 @@
# https://stackoverflow.com/questions/75318609/matrix-strategy-over-entire-workflow-in-github-actions/75337311#75337311
name: be
on:
push:
paths: [be/**]
defaults:
run:
working-directory: be
jobs:
phpstan:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: ./vendor/bin/phpstan analyse --error-format=github

psalm:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: ./vendor/bin/psalm --output-format=github

phpcs:
runs-on: [ubuntu-latest, windows-latest, macos-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

# https://github.com/staabm/annotate-pull-request-from-checkstyle
pint:
runs-on: [ubuntu-latest, windows-latest, macos-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, windows-latest, macos-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, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: ./vendor/bin/phpmd . github cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor # https://github.com/phpmd/phpmd/issues/506
build:
strategy:
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
uses: ./.github/baseflows/be.yml
with:
runs-on: ${{ matrix.runs-on }}
50 changes: 5 additions & 45 deletions .github/workflows/c#.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,14 @@
# https://stackoverflow.com/questions/75318609/matrix-strategy-over-entire-workflow-in-github-actions/75337311#75337311
name: c#
on:
push:
paths: [c#/**]
defaults:
run:
working-directory: c#
jobs:
build:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
strategy:
matrix:
project: [crawler, imagePipeline, shared, tbClient]
runs-on: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/c#
- run: dotnet build --no-restore -c Release ${{ matrix.project }}

ReSharper:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/c#

- id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
${{ github.workspace }}/.resharper
~/.dotnet/tools
key: ${{ runner.os }}-resharper
restore-keys: ${{ runner.os }}-resharper-

- uses: muno92/resharper_inspectcode@v1
with:
version: 2024.*
minimumReportSeverity: info
minimumSeverity: warning
solutionPath: c#/tbm.sln
cachesHome: ${{ github.workspace }}/.resharper

# https://github.com/actions/runner/issues/1478
- uses: actions/cache/save@v4
if: always() && steps.cache-restore.outputs.cache-hit != 'true'
with:
path: |
${{ github.workspace }}/.resharper
~/.dotnet/tools
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
uses: ./.github/baseflows/c#.yml
with:
runs-on: ${{ matrix.runs-on }}
36 changes: 9 additions & 27 deletions .github/workflows/fe.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
# https://stackoverflow.com/questions/75318609/matrix-strategy-over-entire-workflow-in-github-actions/75337311#75337311
name: fe
on:
push:
paths: [fe/**]
defaults:
run:
working-directory: fe
jobs:
tsc:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fe
- run: yarn run vue-tsc

eslint:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fe
- run: yarn run eslint src

codechecks:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps: # contains CVE that triggers Dependabot
- uses: actions/checkout@v4
- uses: ./.github/actions/fe
- run: |
yarn add -D typecov @codechecks/client
yarn run codechecks ../.github/codechecks.yml
env:
CC_SECRET: ${{ secrets.CC_SECRET }}
build:
strategy:
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
uses: ./.github/baseflows/fe.yml
with:
runs-on: ${{ matrix.runs-on }}

0 comments on commit 92f1dc2

Please sign in to comment.