Skip to content

Commit

Permalink
NTR - Use composable actions instead of workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
pweyck committed Aug 14, 2024
1 parent 8697b2e commit 454723e
Show file tree
Hide file tree
Showing 7 changed files with 571 additions and 563 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,26 @@ on:
- cron: '0 3 * * *'

jobs:
unit:
uses: shopware/github-actions/.github/workflows/admin-jest.yml@main
with:
extensionName: ${{ github.event.repository.name }}
shopwareVersion: trunk
uploadCoverage: true
secrets:
codecovToken: ${{ secrets.CODECOV_TOKEN }}
jest:
runs-on: ubuntu-latest
steps:
- uses: shopware/github-actions/setup-extension@add-setup-extension-action
with:
extensionName: ${{ github.event.repository.name }}
install: true
installAdmin: true
- run: npm --version

- name: Jest Unit Tests
shell: bash
working-directory: custom/plugins/${{ github.event.repository.name }}/src/Resources/app/administration
run: npm run unit -- --coverage

- name: Upload Coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
root_dir: ${{ github.workspace }}/custom/plugins/${{ inputs.extensionName }}
working-directory: ${{ github.workspace }}/custom/plugins/${{ inputs.extensionName }}
directory: ${{ github.workspace }}/custom/plugins/${{ inputs.extensionName }}/src/Resources/app/administration
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ on:
- master

jobs:
build:
uses: shopware/github-actions/.github/workflows/build-zip.yml@main
with:
extensionName: ${{ github.event.repository.name }}
phpunit:
runs-on: ubuntu-latest
steps:
- name: build
uses: shopware/github-actions/build-zip@main
with:
extensionName: ${{ github.event.repository.name }}
47 changes: 33 additions & 14 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,39 @@ on:

jobs:
cs:
if: github.event_name != 'schedule'
uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

phpstan:
uses: shopware/github-actions/.github/workflows/phpstan.yml@main
with:
extensionName: ${{ github.event.repository.name }}
shopwareVersion: trunk
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: php-cs-fixer:3.51.0, cs2pr

- name: Run PHP CS Fixer
shell: bash
run: php-cs-fixer fix . --dry-run [email protected],no_unused_imports --format=checkstyle | cs2pr

phpunit:
uses: shopware/github-actions/.github/workflows/phpunit.yml@main
with:
extensionName: ${{ github.event.repository.name }}
shopwareVersion: trunk
uploadCoverage: true
secrets:
codecovToken: ${{ secrets.CODECOV_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: shopware/github-actions/setup-extension@add-setup-extension-action
with:
extensionName: ${{ github.event.repository.name }}

- name: Run PHPUnit
shell: bash
working-directory: custom/plugins/${{ github.event.repository.name }}
run: ${{ github.workspace }}/vendor/bin/phpunit

phpstan:
runs-on: ubuntu-latest
steps:
- uses: shopware/github-actions/setup-extension@add-setup-extension-action
with:
extensionName: ${{ github.event.repository.name }}
- uses: shopware/github-actions/phpstan@add-setup-extension-action
with:
extensionName: ${{ github.event.repository.name }}
30 changes: 17 additions & 13 deletions src/Resources/app/administration/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ module.exports = {
},

preset: './node_modules/@shopware-ag/jest-preset-sw6-admin/jest-preset.js',

globals: {
adminPath: process.env.ADMIN_PATH,
},

rootDir: './',

moduleDirectories:[
moduleDirectories: [
'<rootDir>/node_modules',
resolve(join(process.env.ADMIN_PATH, '/node_modules')),
],
Expand All @@ -34,27 +35,21 @@ module.exports = {
coverageReporters: [
'text',
'cobertura',
'html-spa',
],

collectCoverageFrom: [
'<rootDir>/src/**/Resources/app/administration/src/**/*.js',
'<rootDir>/src/**/Resources/app/administration/src/**/*.ts',
'<rootDir>/src/**/*.(j|t)s',
],

coverageProvider: 'v8',

reporters: [
'default',
['./node_modules/jest-junit/index.js', {
suiteName: 'LanguagePack Administration',
outputDirectory: artifactsPath,
outputName: 'administration.junit.xml',
}],

setupFilesAfterEnv: [
resolve(join(process.env.ADMIN_PATH, '/test/_setup/prepare_environment.js')),
],

moduleNameMapper: {
'^\@shopware-ag\/admin-extension-sdk\/es\/(.*)': resolve(join(process.env.ADMIN_PATH, '/node_modules')) + '/@shopware-ag/admin-extension-sdk/umd/$1',
'^\@shopware-ag\/meteor-admin-sdk\/es\/(.*)': `${process.env.ADMIN_PATH}/node_modules/@shopware-ag/meteor-admin-sdk/umd/$1`,
'^@administration(.*)$': `${process.env.ADMIN_PATH}/src$1`,
vue$: '@vue/compat/dist/vue.cjs.js',
},
Expand All @@ -66,4 +61,13 @@ module.exports = {
testEnvironmentOptions: {
customExportConditions: ['node', 'node-addons'],
},
};

reporters: [
'default',
['./node_modules/jest-junit/index.js', {
suiteName: 'LanguagePack Administration',
outputDirectory: artifactsPath,
outputName: 'administration.junit.xml',
}],
],
};
Loading

0 comments on commit 454723e

Please sign in to comment.