-
Notifications
You must be signed in to change notification settings - Fork 11
153 lines (137 loc) · 4.29 KB
/
ci.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
drupal_codequality:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Drupal Code Quality
uses: hussainweb/drupalqa-action@v1
id: drupalqa
with:
checks: |
phplint: {}
phpcs:
standard: phpcs.xml.dist
ignore: /node_modules/
phpmd:
ruleset: phpmd.xml
suffixes: php
frontend_codequality:
runs-on: ubuntu-latest
container: node:lts
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Frontend Code Quality
run: |
cd web/themes/custom/contribtracker
npm ci
npm run lint
drupal_test:
runs-on: ubuntu-latest
container: hussainweb/drupal-base:php8.1
services:
mariadb:
image: ghcr.io/contrib-tracker/backend-db:main
env:
ALLOW_EMPTY_PASSWORD: "yes"
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get Cache Directories
id: cache-dir
run: |
echo "::set-output name=composer-dir::$(composer config cache-files-dir)"
echo "::set-output name=npm-dir::$(npm config get cache)"
- uses: actions/cache@v3
with:
path: ${{ steps.cache-dir.outputs.composer-dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Test
run: |
./.github/ci.sh
composer install -o --no-progress
./vendor/drush/drush/drush deploy -y
./vendor/bin/phpunit --testsuite unit
./vendor/bin/phpunit --bootstrap=./vendor/weitzman/drupal-test-traits/src/bootstrap-fast.php --configuration ./phpunit.xml --testsuite existing-site
frontend_vr:
permissions:
packages: read
contents: read
needs: [frontend_codequality]
runs-on: ubuntu-latest
container: skippednote/drupal-cypress:1.0.6
env:
# For Cypress.
CYPRESS_ADMIN_USERNAME: ct-admin
CYPRESS_ADMIN_PASSWORD: ct-admin
services:
mariadb:
image: ghcr.io/contrib-tracker/backend-db:main
env:
ALLOW_EMPTY_PASSWORD: "yes"
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get Cache Directories
id: cache-dir
run: |
echo "::set-output name=composer-dir::$(composer config cache-files-dir)"
echo "::set-output name=npm-dir::$(npm config get cache)"
- uses: actions/cache@v3
with:
path: ${{ steps.cache-dir.outputs.composer-dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: actions/cache@v3
with:
path: ${{ steps.cache-dir.outputs.npm-dir }}
key: ${{ runner.os }}-node-${{ hashFiles('web/themes/custom/contribtracker/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Test
run: |
./.github/ci.sh
composer install -o --no-progress
./vendor/bin/drush deploy -y
./vendor/bin/drush upwd ct-admin "ct-admin"
cd web/themes/custom/contribtracker
npm ci --cache $CI_PROJECT_DIR/.npm --prefer-offline
npm run build
npm run vr
- name: Archive Cypress recordings
if: always()
uses: actions/upload-artifact@v3
with:
name: cypress-recordings
path: |
web/themes/custom/contribtracker/cypress/screenshots
web/themes/custom/contribtracker/cypress/videos
retention-days: 3
deploy:
needs:
- drupal_codequality
- drupal_test
- frontend_vr
runs-on: ubuntu-latest
# Dependabot PR's can't access secrets, so we can't deploy.
if: github.actor != 'dependabot[bot]'
steps:
- uses: axelerant/platformsh-deploy-action@main
with:
project-id: 'brbqplxd7ycq6'
cli-token: ${{ secrets.PLATFORM_CLI_TOKEN }}