| 1 |
name: CMake |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [master] |
| 6 |
tags: ["v*.*.*"] |
| 7 |
pull_request: |
| 8 |
branches: [master] |
| 9 |
workflow_dispatch: |
| 10 |
|
| 11 |
env: |
| 12 |
BUILD_TYPE: Release |
| 13 |
REGISTRY: ghcr.io |
| 14 |
|
| 15 |
defaults: |
| 16 |
run: |
| 17 |
shell: bash |
| 18 |
|
| 19 |
jobs: |
| 20 |
build: |
| 21 |
runs-on: ubuntu-latest |
| 22 |
permissions: |
| 23 |
contents: read |
| 24 |
|
| 25 |
steps: |
| 26 |
- uses: actions/checkout@v6 |
| 27 |
|
| 28 |
- name: Create Build Environment |
| 29 |
run: cmake -E make_directory ${{github.workspace}}/build |
| 30 |
|
| 31 |
- name: Install dependencies |
| 32 |
run: | |
| 33 |
sudo apt-get update |
| 34 |
sudo apt-get -y install doxygen git-core graphviz libboost-all-dev libfftw3-dev libhdf5-serial-dev libxml2-utils libpugixml-dev socat |
| 35 |
|
| 36 |
- name: Configure CMake |
| 37 |
working-directory: ${{github.workspace}}/build |
| 38 |
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 39 |
|
| 40 |
- name: Build |
| 41 |
working-directory: ${{github.workspace}}/build |
| 42 |
run: | |
| 43 |
cmake --build . --config $BUILD_TYPE |
| 44 |
cmake --build . --target doc --config $BUILD_TYPE |
| 45 |
|
| 46 |
- name: Test XML |
| 47 |
working-directory: ${{github.workspace}}/schema |
| 48 |
run: for xml_file in *.xml; do xmllint --schema ismrmrd.xsd "$xml_file" --noout; done |
| 49 |
|
| 50 |
- name: Test |
| 51 |
working-directory: ${{github.workspace}}/build/tests |
| 52 |
run: ./test_ismrmrd |
| 53 |
|
| 54 |
build-docker: |
| 55 |
runs-on: ubuntu-latest |
| 56 |
needs: build |
| 57 |
permissions: |
| 58 |
contents: read |
| 59 |
packages: write |
| 60 |
steps: |
| 61 |
- uses: actions/checkout@v6 |
| 62 |
- name: Build and test docker images |
| 63 |
working-directory: ${{github.workspace}} |
| 64 |
run: | |
| 65 |
./docker/build-images.sh |
| 66 |
./docker/test-images.sh |
| 67 |
|
| 68 |
- name: Log into registry ${{ env.REGISTRY }} |
| 69 |
uses: docker/login-action@v3 |
| 70 |
with: |
| 71 |
registry: ${{ env.REGISTRY }} |
| 72 |
username: ${{ github.actor }} |
| 73 |
password: ${{ secrets.GITHUB_TOKEN }} |
| 74 |
|
| 75 |
- name: Push images |
| 76 |
if: ${{ github.event_name == 'release' }} |
| 77 |
working-directory: ${{github.workspace}} |
| 78 |
run: | |
| 79 |
./docker/build-images.sh --tag "${GITHUB_REF##*/}" --push |
| 80 |
|
| 81 |
build-static: |
| 82 |
runs-on: ubuntu-latest |
| 83 |
needs: build |
| 84 |
permissions: |
| 85 |
contents: read |
| 86 |
steps: |
| 87 |
- uses: actions/checkout@v6 |
| 88 |
- name: Build and test static binaries |
| 89 |
run: ./docker/build-and-test-variant.sh static |
| 90 |
|
| 91 |
build-cpp98: |
| 92 |
runs-on: ubuntu-latest |
| 93 |
needs: build |
| 94 |
permissions: |
| 95 |
contents: read |
| 96 |
steps: |
| 97 |
- uses: actions/checkout@v6 |
| 98 |
- name: Build and test C++98 binaries |
| 99 |
run: ./docker/build-and-test-variant.sh cpp98 |