-
Notifications
You must be signed in to change notification settings - Fork 209
144 lines (124 loc) · 5.47 KB
/
tests_build.yml
File metadata and controls
144 lines (124 loc) · 5.47 KB
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
name: Test Suite Evaluation
on:
pull_request_target:
branches: develop
# TODO: run this task only on PR in production; use push event for testing
#push:
#branches:
# - '**'
# globals
env:
# general settings
MAIN_REPO_OWNER: rism-ch # Main repo owner (default: rism-ch; should not be changed)
# build artifacts
TOOLKIT_BUILD: toolkit-build
# gh-pages
GH_PAGES_REPO: ${{ github.repository_owner }}/verovio.org # works from rism-ch and from forks
GH_PAGES_BRANCH: gh-pages
# directories
GH_PAGES_DIR: gh-pages-dir
PR_DIR: pr-${{ github.event.pull_request.head.sha }}
DEV_DIR: dev-dir
TEMP_DIR: temp-dir
jobs:
###################################################
# Build the Python toolkit and run the test suite #
###################################################
build_python:
name: Build the test suite
runs-on: ubuntu-20.04
steps:
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Get Short SHA
run: |
echo "SHORT_SHA=`echo ${{ github.event.pull_request.head.sha }} | cut -c1-7`" >> $GITHUB_ENV
- name: Add additional environment variables for creating URL slugs
run: |
echo "OUTPUT_DIR=${{ github.event.pull_request.number }}/${{ env.SHORT_SHA }}" >> $GITHUB_ENV
- name: Checkout GH_PAGES_BRANCH into GH_PAGES_DIR
uses: actions/checkout@v2
with:
repository: ${{ env.GH_PAGES_REPO }}
ref: ${{ env.GH_PAGES_BRANCH }}
path: ${{ env.GH_PAGES_DIR }}
- name: Create directories and install packages
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ env.DEV_DIR }}
mkdir -p ${{ env.PR_DIR }}
mkdir -p ${{ env.TEMP_DIR }}/${{ env.DEV_DIR }}
mkdir -p ${{ env.TEMP_DIR }}/${{ env.PR_DIR }}
mkdir -p ${{ env.OUTPUT_DIR }}
ls -alh
ls -alh ${{ env.OUTPUT_DIR }}
sudo apt-get install librsvg2-bin openresolv wireguard
sudo echo "${{ secrets.VPN_CONFIGURATION }}" > wg0.conf
rsvg-convert --version
python3 -m pip install diffimg lxml xmldiff
- name: Set up Wireguard VPN
working-directory: ${{ github.workspace }}
run: |
sudo wg-quick up ./wg0.conf
- name: Checkout the dev branch
uses: actions/checkout@v2
with:
ref: develop
path: ${{ env.DEV_DIR }}/
- name: Install the VerovioText font
working-directory: ${{ github.workspace }}/${{ env.DEV_DIR }}/
run: |
sudo cp ./fonts/VerovioText-1.0.ttf /usr/local/share/fonts
sudo fc-cache -f -v
- name: Build Python toolkit and run the tests for the dev branch
working-directory: ${{ github.workspace }}/${{ env.DEV_DIR }}/bindings
run: |
cmake ../cmake -DBUILD_AS_PYTHON=ON -B python
cd python
make -j8
python3 ../../doc/test-suite.py ${{ github.workspace }}/${{env.GH_PAGES_DIR}}/_tests ${{ github.workspace }}/${{ env.TEMP_DIR }}/${{ env.DEV_DIR }}/
../../doc/test-suite-to-png.sh ${{ github.workspace }}/${{ env.TEMP_DIR }}/${{ env.DEV_DIR }}/
- name: Checkout the PR
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
path: ${{ env.PR_DIR }}/
- name: Build Python toolkit and run the tests for the PR
working-directory: ${{ github.workspace }}/${{ env.PR_DIR }}/bindings
run: |
cmake ../cmake -DBUILD_AS_PYTHON=ON -B python
cd python
make -j8
python3 ../../doc/test-suite.py ${{ github.workspace }}/${{env.GH_PAGES_DIR}}/_tests ${{ github.workspace }}/${{ env.TEMP_DIR }}/${{ env.PR_DIR }}/
../../doc/test-suite-to-png.sh ${{ github.workspace }}/${{ env.TEMP_DIR }}/${{ env.PR_DIR }}/
- name: Compare the tests
working-directory: ${{ github.workspace }}/${{ env.DEV_DIR }}/doc
run: |
python3 ./test-suite-diff.py ${{ github.workspace }}/${{ env.TEMP_DIR }}/${{ env.PR_DIR }}/ ${{ github.workspace }}/${{ env.TEMP_DIR }}/${{ env.DEV_DIR }}/ ${{ github.workspace }}/${{ env.OUTPUT_DIR }}/
ls -al
# Deploy to remote server. Uses the REF_NAME_SLUG to ensure that it maps to any existing directories on the deployment server.
- name: Deploy with rsync
uses: burnett01/rsync-deployments@4.1
if: ${{ github.repository_owner == env.MAIN_REPO_OWNER }}
with:
switches: -avzr --exclude="uploads" --exclude="fileadmin"
path: ${{ github.event.pull_request.number }}
remote_path: ${{ secrets.TEST_SUITE_DEPLOY_PATH }}
remote_host: ${{ secrets.TEST_SUITE_DEPLOY_SERVER }}
remote_user: ${{ secrets.TEST_SUITE_DEPLOY_USER }}
remote_key: ${{ secrets.TEST_SUITE_DEPLOY_key }}
- name: Disconnect VPN
working-directory: ${{ github.workspace }}
run: |
sudo wg-quick down ./wg0.conf
- name: Add comment with link
if: ${{ github.repository_owner == env.MAIN_REPO_OWNER }}
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Test suite regression test available at https://test-suite.verovio.org/${{ env.OUTPUT_DIR }}'
})