-
Notifications
You must be signed in to change notification settings - Fork 5
72 lines (60 loc) · 2.94 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Main CI workflow
on:
pull_request:
workflow_dispatch:
jobs:
build:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_dispatch')
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [8.2,8.3]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
- name: Define Hyvä Checkout repositories
run: |
composer config repositories.hyva-themes/hyva-checkout git [email protected]:hyva-checkout/checkout.git
composer config repositories.hyva-themes/magento2-theme-module git [email protected]:hyva-themes/magento2-theme-module.git
composer config repositories.hyva-themes/magento2-reset-theme git [email protected]:hyva-themes/magento2-reset-theme.git
composer config repositories.hyva-themes/magento2-email-theme git [email protected]:hyva-themes/magento2-email-module.git
composer config repositories.hyva-default-theme git [email protected]:hyva-themes/magento2-default-theme.git
- name: Configure SSH access to Hyvä Gitlab
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
HYVA_GITLAB_SSH_KEY: ${{ secrets.GITLAB_SSH_KEY }}
run: |
mkdir -p ~/.ssh
ssh-keyscan gitlab.hyva.io >> ~/.ssh/known_hosts
echo "${HYVA_GITLAB_SSH_KEY}" > ~/.ssh/hyva_id_rsa
chmod 600 ~/.ssh/hyva_id_rsa
ssh-agent -a ${SSH_AUTH_SOCK} > /dev/null
ssh-add ~/.ssh/hyva_id_rsa
- name: Install the plugin
run: |
echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json
composer install --prefer-dist
env:
CI: true
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }}
MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }}
- name: Code Sniffer
run: vendor/bin/phpcs .
- name: Run PHPUnit
run: vendor/bin/phpunit --coverage-clover=build/clover.xml --log-junit=build/tests-log.xml -c Test/phpunit.xml Test/Unit
- name: Fix code coverage paths
run: sed -i "s;`pwd`/;;g" build/*.xml
- name: SonarCloud Scan
if: ${{ env.SONAR_TOKEN }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}