|
| 1 | +on: [push, pull_request] |
| 2 | +name: BuildAndTest |
| 3 | +jobs: |
| 4 | + build: |
| 5 | + strategy: |
| 6 | + fail-fast: false |
| 7 | + matrix: |
| 8 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + name: Build |
| 11 | + steps: |
| 12 | + # Get current date (used to create a daily cache of dependencies) |
| 13 | + - name: Get current date |
| 14 | + id: date |
| 15 | + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" |
| 16 | + |
| 17 | + # Checkout gnatcoll sources |
| 18 | + - name: Get GNATCOLL |
| 19 | + uses: actions/checkout@v2 |
| 20 | + |
| 21 | + # Handle installation of the compiler |
| 22 | + # (Community 2020 for MacOS and Community 2021 for others) |
| 23 | + - name: Cache compiler installation |
| 24 | + id: cache-compiler |
| 25 | + uses: actions/cache@v2 |
| 26 | + with: |
| 27 | + path: ./cached_gnat |
| 28 | + key: ${{ runner.os }}-gnat |
| 29 | + - name: Get GNAT Community 2021 toolchain |
| 30 | + if: ${{ runner.os != 'macOS' }} |
| 31 | + uses: ada-actions/toolchain@ce2021 |
| 32 | + with: |
| 33 | + distrib: community |
| 34 | + install_dir: ./cached_gnat |
| 35 | + - name: Get GNAT Community 2020 toolchain |
| 36 | + if: ${{ runner.os == 'macOS' }} |
| 37 | + uses: ada-actions/toolchain@ce2020 |
| 38 | + with: |
| 39 | + distrib: community |
| 40 | + install_dir: ./cached_gnat |
| 41 | + |
| 42 | + # Handle dependencies |
| 43 | + - name: Cache dependency artifacts on daily basis |
| 44 | + id: cache-deps |
| 45 | + uses: actions/cache@v2 |
| 46 | + with: |
| 47 | + path: ./build_deps |
| 48 | + key: ${{ runner.os }}-${{ steps.date.outputs.date }}-build-deps-v2 |
| 49 | + |
| 50 | + # On MacOS, build a recent libgpr |
| 51 | + - name: Get gprbuild for libgpr |
| 52 | + if: ${{ runner.os == 'macOS' && steps.cache-deps.outputs.cache-hit != 'true' }} |
| 53 | + uses: actions/checkout@v2 |
| 54 | + with: |
| 55 | + repository: AdaCore/gprbuild |
| 56 | + path: gprbuild |
| 57 | + fetch-depth: 0 # To be able do `git revert` |
| 58 | + - name: Revert a libgpr patch (MacOS X only) |
| 59 | + # The latest libgpr doesn't support GNAT CE 2020, but on MacOS X we |
| 60 | + # don't have GNAT CE 2021. Let's revert this commit for now. |
| 61 | + if: ${{ runner.os == 'macOS' && steps.cache-deps.outputs.cache-hit != 'true' }} |
| 62 | + run: git -C gprbuild revert --no-edit 3341766255bf5ab90fe05a8e162894b7830adca6 |
| 63 | + |
| 64 | + - name: Build gprbuild |
| 65 | + if: ${{ runner.os == 'macOS' && steps.cache-deps.outputs.cache-hit != 'true' }} |
| 66 | + run: | |
| 67 | + CWD=$(pwd) |
| 68 | + mkdir -p ./build_deps/libs |
| 69 | + cd gprbuild && make libgpr.build && make libgpr.install prefix=$CWD/build_deps/libs |
| 70 | +
|
| 71 | + # Get latest e3-core and e3-testsuite and cache resulting wheels |
| 72 | + - name: Get e3-testsuite |
| 73 | + uses: actions/checkout@v2 |
| 74 | + if: steps.cache-deps.outputs.cache-hit != 'true' |
| 75 | + with: |
| 76 | + repository: AdaCore/e3-testsuite |
| 77 | + path: e3-testsuite |
| 78 | + - name: Get e3-core |
| 79 | + uses: actions/checkout@v2 |
| 80 | + if: steps.cache-deps.outputs.cache-hit != 'true' |
| 81 | + with: |
| 82 | + repository: AdaCore/e3-core |
| 83 | + path: e3-core |
| 84 | + - uses: actions/setup-python@v2 |
| 85 | + with: |
| 86 | + python-version: '3.8' |
| 87 | + - name: Install e3-testsuite (Windows) |
| 88 | + if: ${{ runner.os == 'Windows' && steps.cache-deps.outputs.cache-hit != 'true' }} |
| 89 | + run: | |
| 90 | + $CWD=$(Get-Location) |
| 91 | + mkdir -p ./build_deps/wheels |
| 92 | + pip3 install wheel |
| 93 | + cd e3-core && python3 ./setup.py -q bdist_wheel --python-tag py38 -d $CWD/build_deps/wheels && |
| 94 | + cd .. && |
| 95 | + cd e3-testsuite && python3 ./setup.py -q bdist_wheel --python-tag py38 -d $CWD/build_deps/wheels |
| 96 | + - name: Install e3-testsuite (Unix) |
| 97 | + if: ${{ runner.os != 'Windows' && steps.cache-deps.outputs.cache-hit != 'true' }} |
| 98 | + run: | |
| 99 | + CWD=$(pwd) |
| 100 | + mkdir -p ./build_deps/wheels |
| 101 | + pip3 install wheel |
| 102 | + (cd e3-core && python3 ./setup.py -q bdist_wheel --python-tag py38 -d $CWD/build_deps/wheels) |
| 103 | + (cd e3-testsuite && python3 ./setup.py -q bdist_wheel --python-tag py38 -d $CWD/build_deps/wheels) |
| 104 | + - name: Create python environment (Unix) |
| 105 | + if: ${{ runner.os != 'Windows' }} |
| 106 | + run: | |
| 107 | + pip install ./build_deps/wheels/*.whl && |
| 108 | + echo "$(pwd)/build_deps/py3-env/bin" >> ${GITHUB_PATH} |
| 109 | + - name: Create python environment (Windows) |
| 110 | + if: ${{ runner.os == 'Windows' }} |
| 111 | + run: | |
| 112 | + $files = Get-Item ./build_deps/wheels/*.whl |
| 113 | + pip install $files && |
| 114 | + echo "$(Get-Location)/build_deps/py3-env;$(Get-Location)/build_deps/py3-env/Scripts" >> $GITHUB_PATH |
| 115 | + # Build, Install and test gnatcoll in DEBUG mode |
| 116 | + - name: Build GNATCOLL |
| 117 | + run: make BUILD=DEBUG |
| 118 | + - name: Install GNATCOLL |
| 119 | + run: make BUILD=DEBUG install |
| 120 | + - name: Test GNATCOLL |
| 121 | + run: (cd testsuite && python3 ./run-tests -j2 --failure-exit-code 1 -E) |
0 commit comments