Develop humdrum #1799
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Suite Evaluation | |
on: | |
pull_request: | |
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-digital # Main repo owner (default: rism-digital; should not be changed) | |
# build artifacts | |
TOOLKIT_BUILD: toolkit-build | |
# gh-pages | |
GH_PAGES_REPO: ${{ github.repository_owner }}/verovio.org # works from rism-digital 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-22.04 | |
steps: | |
- uses: FranzDiebold/[email protected] | |
- 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@v4 | |
with: | |
repository: ${{ env.GH_PAGES_REPO }} | |
ref: ${{ env.GH_PAGES_BRANCH }} | |
path: ${{ env.GH_PAGES_DIR }} | |
submodules: recursive | |
- 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 openresolv wireguard | |
sudo echo "${{ secrets.VPN_CONFIGURATION }}" > wg0.conf | |
python3 -m pip install diffimg jsondiff lxml xmldiff cairosvg | |
- name: Checkout the dev branch | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
path: ${{ env.DEV_DIR }}/ | |
- name: Install the Leipzig font | |
working-directory: ${{ github.workspace }}/${{ env.DEV_DIR }}/ | |
run: | | |
sudo cp ./fonts/Leipzig/Leipzig.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 -DNO_HUMDRUM_SUPPORT=ON -DNO_ABC_SUPPORT=ON -DNO_PAE_SUPPORT=ON -DBUILD_AS_PYTHON=ON -DVRV_DYNAMIC_CAST=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 }}/ | |
python3 ../../doc/test-suite.py ${{ github.workspace }}/${{env.GH_PAGES_DIR}}/musicxmlTestSuite ${{ github.workspace }}/${{ env.TEMP_DIR }}/${{ env.DEV_DIR }}/ | |
- name: Checkout the PR | |
uses: actions/checkout@v4 | |
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 -DNO_HUMDRUM_SUPPORT=ON -DNO_ABC_SUPPORT=ON -DNO_PAE_SUPPORT=ON -DBUILD_AS_PYTHON=ON -DVRV_DYNAMIC_CAST=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 }}/ | |
python3 ../../doc/test-suite.py ${{ github.workspace }}/${{env.GH_PAGES_DIR}}/musicxmlTestSuite ${{ 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 | |
- name: Upload results as artefacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-suite-diff | |
path: ${{ github.workspace }}/${{ env.OUTPUT_DIR }}/ | |
- name: Check existence of the log.md file | |
id: check_files | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "${{ github.workspace }}/${{ env.OUTPUT_DIR }}/log.md" | |
- name: Show the list of changes detected | |
if: steps.check_files.outputs.files_exists == 'true' | |
run: | | |
echo "This is the list of tests for which a change has been detected:" | |
cat ${{ github.workspace }}/${{ env.OUTPUT_DIR }}/log.md |