-
Notifications
You must be signed in to change notification settings - Fork 1
150 lines (125 loc) · 4.66 KB
/
build.yaml
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
name: Build
on:
workflow_dispatch: # Allow for manual trigger!
push:
branches:
- $default-branch,
- '**pipeline'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.x, 20.x ]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Copy original Frontend
run: cp -r js js_bac
- name: Build Frontend Production
run: |
make npm-init
make build-js-production
- name: Make sure production is commited
run: |
diff -rq js js_bac
if [ $? -eq 1 ];then
echo "Build files differ! Rebuild frontend with make build-js-production and submit changes!"
exit 1
fi
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.0, 8.1, 8.2 ]
nextcloud-version-branch: [ stable25, stable26, stable27 ] # see https://github.com/nextcloud/server/branches
exclude:
- php-version: 8.2
nextcloud-version-branch: stable25
- php-version: 8.0
nextcloud-version-branch: stable27
name: Deploy b2sharebridge-app in a NC environment
needs: build
env:
DB_DATABASE: oc_autotest
DB_ROOT: root
steps:
- name: Setup MySQL
run: |
sudo /etc/init.d/mysql start
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e 'CREATE DATABASE ${{ env.DB_DATABASE }};'
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"
- uses: actions/checkout@v3
name: Checkout Nextcloud ${{matrix.nextcloud-version-branch}}
with:
repository: nextcloud/server
ref: ${{matrix.nextcloud-version-branch}}
fetch-depth: 1
submodules: true # 'Composer autoloader' is required in order to run the code check
- uses: actions/checkout@v3
name: Add b2sharebridge to nextcloud
with:
path: apps/b2sharebridge
- name: Install PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-file: apps/b2sharebridge/tests/travis/php.ini
tools: phpunit:9.5, phpcs, phpcbf
- name: Configure NC
run: |
mkdir data
./occ maintenance:install --database-name $DB_DATABASE --database-user oc_autotest --admin-user admin --admin-pass admin --database mysql --database-pass=''
./occ app:enable b2sharebridge
- name: Unit Tests
run: |
cd apps/b2sharebridge/tests
phpunit -c phpunit.xml unit
- name: Integration Tests
run: |
cd apps/b2sharebridge/tests
phpunit -c phpunit.integration.xml integration
- name: Test Background Job
if: ${{ matrix.nextcloud-version-branch != 'stable22' }} # https://github.com/actions/runner/issues/1173 # 'background-job'-cmd is only available since nc23
run: |
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "INSERT INTO oc_b2sharebridge_server (name, publish_url) VALUES ('B2SHARE Test Server', 'https://trng-b2share.eudat.eu')" ${{ env.DB_DATABASE }}
job_id=`mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -s -N -e "SELECT id FROM oc_jobs WHERE class LIKE '%B2shareCommunityFetcher'" ${{ env.DB_DATABASE }}`
./occ background-job:execute $job_id
num_communities=`mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -s -N -e "SELECT COUNT(1) FROM oc_b2sharebridge_communities" ${{ env.DB_DATABASE }}`
echo "$num_communities communities fetched!"
exit $(($num_communities == 0))
- name: Style checking
run: |
cd apps/b2sharebridge
make npm-init
make stylelint
- name: Fix Style Lint
run: |
cd apps/b2sharebridge
make stylelint-fix
- name: Js Lint checking
continue-on-error: true
run: |
cd apps/b2sharebridge
make lint
- name: Fix Js Lint
continue-on-error: true
run: |
cd apps/b2sharebridge
make lint-fix
- name: Php Lint checking
continue-on-error: true
run: |
cd apps/b2sharebridge
make phplint
- name: Fix Php Lint
run: |
cd apps/b2sharebridge
make phplint-fix