-
Notifications
You must be signed in to change notification settings - Fork 127
153 lines (144 loc) · 4.99 KB
/
oidc-integration-test.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: OIDC integration tests
on:
pull_request:
push:
branches:
- qa/**
- stable/**
jobs:
integration-tests:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
browser: [Chrome, Electron, Firefox]
name: ${{ matrix.browser }}
env:
COMPOSE_FILE: ${{ github.workspace }}/docker/docker-compose.dev.yml
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Start containerized services
run: |
sudo sysctl -w vm.max_map_count=262144
docker compose -p ci up -d percona elasticsearch gearmand
- name: Set CI-specific Realm File
run: echo "REALM_FILE=../test/etc/keycloak/realm.json" >> $GITHUB_ENV
- name: Launch Keycloak service
run: |
docker compose -p ci -f ${{ github.workspace }}/docker/docker-compose.keycloak.yml up -d
- name: Wait for Keycloak to be Ready
run: |
echo "Waiting for Keycloak to be ready..."
for i in {1..30}; do
if nc -z localhost 8080; then
echo "Keycloak is up!"
break
fi
echo "Waiting for Keycloak..."
sleep 5
done
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
extensions: apcu, opcache
- name: Setup PHP-FPM
run: |
sudo apt install php7.4-fpm
sudo service php7.4-fpm start
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: 20.04-7.4-composer-${{ hashFiles('composer.lock') }}
- name: Install Composer dependencies
run: composer install
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: |
~/.npm
~/.cache/Cypress
key: npm-${{ hashFiles('package-lock.json') }}
- name: Install NPM dependencies
run: sudo npm install -g npm && npm ci
- name: Modify Gearman config
run: |
echo -e "all:\n servers:\n default: 127.0.0.1:63005" \
> apps/qubit/config/gearman.yml
- name: Build themes
run: |
sudo npm install -g "less@<4.0.0"
make -C plugins/arDominionPlugin
make -C plugins/arArchivesCanadaPlugin
npm run build
- name: Run the installer
run: |
php symfony tools:install \
--database-host=127.0.0.1 \
--database-port=63003 \
--database-name=atom \
--database-user=atom \
--database-password=atom_12345 \
--search-host=127.0.0.1 \
--search-port=63002 \
--search-index=atom \
--demo \
--no-confirmation
- name: Update OIDC plugin app.yml file
run: sudo cp test/etc/oidc/arOidcPlugin/config/app.yml plugins/arOidcPlugin/config
- name: Update factories.yml to use oidcUser
run: |
sudo sed -i 's/class: myUser/class: oidcUser/' config/factories.yml
- name: Install OIDC Plugin
run: |
php symfony tools:atom-plugins add arOidcPlugin
- name: Change filesystem permissions
run: sudo chown -R www-data:www-data ${{ github.workspace }}
- name: Start application services
run: |
sudo cp test/etc/fpm_conf /etc/php/7.4/fpm/pool.d/atom.conf
sudo rm /etc/php/7.4/fpm/pool.d/www.conf
sudo systemctl restart php7.4-fpm
sudo php-fpm7.4 --test
sudo cp test/etc/worker_conf /usr/lib/systemd/system/atom-worker.service
sudo systemctl daemon-reload
sudo systemctl start atom-worker
- name: Install and configure Nginx
run: |
sudo apt install nginx
sudo cp test/etc/nginx_conf /etc/nginx/sites-available/atom
sudo ln -s /etc/nginx/sites-available/atom /etc/nginx/sites-enabled
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx
- name: Create writable Cypress videos and screenshots dirs
run: |
sudo mkdir -p ${{ github.workspace }}/cypress/screenshots ${{ github.workspace }}/cypress/videos
sudo chmod a=rwx ${{ github.workspace }}/cypress/screenshots ${{ github.workspace }}/cypress/videos
- name: Ensure NGINX is Running
run: sudo systemctl status nginx
- name: Run tests
env:
BROWSER: ${{ matrix.browser }}
CYPRESS_VIDEO: false
CYPRESS_BASE_URL: http://localhost
run: npx cypress run --config-file cypress.config.oidc.js --browser ${BROWSER,}
- name: Ensure NGINX is Running
run: sudo systemctl status nginx
- name: Output NGINX error log
if: always()
run: sudo cat /var/log/nginx/error.log
- name: Output AtoM error test log
if: always()
run: sudo cat ./log/qubit_test.log
- name: Output AtoM error prod log
if: always()
run: sudo cat ./log/qubit_prod.log
- name: Tear down services
if: always()
run: |
docker compose -p ci down
docker compose -p ci -f ${{ github.workspace }}/docker/docker-compose.keycloak.yml down