Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor github ci to use matrix strategy instead. #1206

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
139 changes: 104 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,110 @@
name: BEAST CI
on:
push:
branches:
- main
pull_request:

on: [push]
# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
BEAGLE_DIR: beagle-lib
BEAGLE_LIB: beagle-lib/usr/local/lib
LD_LIBRARY_PATH: beagle-lib/usr/local/lib
BEAGLE_BRANCH: v4_release

jobs:
build:
runs-on: ubuntu-latest
env:
BEAGLE_DIR: beagle-lib
BEAGLE_LIB: beagle-lib/usr/local/lib
LD_LIBRARY_PATH: beagle-lib/usr/local/lib
BEAGLE_BRANCH: v4_release
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: "8"
distribution: "adopt"
- name: Setup cmake
uses: lukka/get-cmake@latest
- name: Cache BEAGLE and BEAST
id: cache
uses: actions/cache@v2
with:
path: |
${{ env.BEAGLE_DIR }}
build/dist
key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }}
- name: Build BEAGLE
if: steps.cache.outputs.cache-hit != 'true'
run: |
chmod +x ./.github/scripts/build_beagle.sh
./.github/scripts/build_beagle.sh
- name: Build BEAST
if: steps.cache.outputs.cache-hit != 'true'
run: ant dist
- name: Check BEAGLE
run: |
ls ${BEAGLE_LIB}
java -jar -Djava.library.path=${BEAGLE_LIB} build/dist/beast.jar -beagle_info
- name: Set up test matrices
id: set-matrices
run: |
echo "xml-matrix=$(ls tests/TestXML/*.xml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
echo "xml-load-state-matrix=$(ls tests/TestXMLwithLoadState/*.xml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
outputs:
xml-matrix: ${{ steps.set-matrices.outputs.xml-matrix }}
xml-load-state-matrix: ${{ steps.set-matrices.outputs.xml-load-state-matrix }}

test-xml:
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file: ${{fromJson(needs.setup.outputs.xml-matrix)}}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
${{ env.BEAGLE_DIR }}
build/dist
key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }}
- name: Run test for ${{ matrix.file }}
run: java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -overwrite ${{ matrix.file }}

test-xml-load-state:
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file: ${{fromJson(needs.setup.outputs.xml-load-state-matrix)}}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
${{ env.BEAGLE_DIR }}
build/dist
key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }}
- name: Run test with load state for ${{ matrix.file }}
run: |
checkpoint=tests/TestXMLwithLoadState/$(basename ${{ matrix.file }} .xml).chkpt
java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -load_state $checkpoint -overwrite ${{ matrix.file }}

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Setup cmake
uses: lukka/get-cmake@latest
# - name: Build BEAGLE
# - run: git clone -b $BEAGLE_BRANCH --depth 1 https://github.com/beagle-dev/beagle-lib.git $BEAGLE_DIR
# - run: cd $BEAGLE_DIR
# - run: mkdir build
# - run: cd build
# - run: echo $PWD
# - run: cmake -DBUILD_CUDA=OFF -DBUILD_OPENCL=OFF ..
# - run: make DESTDIR=BEAGLE_DIR
- run: chmod +x ci/build_beagle.sh
- run: ci/build_beagle.sh
- run: ant dist
- run: ls ${BEAGLE_LIB}
- run: java -jar -Djava.library.path=${BEAGLE_LIB} build/dist/beast.jar -beagle_info
- run: chmod +x ci/test.sh
- run: ci/test.sh
# - run: chmod +x ci/test_with_load_state.sh
# - run: ci/test_with_load_state.sh
- run: ant -Djava.library.path=${BEAGLE_LIB} junit
test-junit:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
${{ env.BEAGLE_DIR }}
build/dist
key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }}
- name: Run JUnit tests
run: ant -Djava.library.path=${BEAGLE_LIB} junit
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ out/
*.tree
*.xml
!examples/**/*.xml
!ci/**/*.xml
!tests/**/*.xml

zig_zag
src/revision.txt
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ci/test.sh → tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ trap 'echo "Ctr + C!"; exit 2' SIGINT
passed=true
failedFiles=()

for file in ci/TestXML/*\.xml
for file in ./TestXML/*\.xml
do
if java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -overwrite $file; then
echo $file passed
Expand Down
4 changes: 2 additions & 2 deletions ci/test_with_load_state.sh → tests/test_with_load_state.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash


for file in ci/TestXMLwithLoadState/*\.xml
for file in ./TestXMLwithLoadState/*\.xml
do
checkpoint=ci/TestXMLwithLoadState/$(basename $file .xml).chkpt
checkpoint=./TestXMLwithLoadState/$(basename $file .xml).chkpt
if java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -load_state $checkpoint -overwrite $file; then
echo $file passed
else
Expand Down
Loading