|
| 1 | +name: Build and test (0.150.5-lcm, scheduled) |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # run every Monday, this refreshes the cache |
| 6 | + - cron: '5 2 * * 1' |
| 7 | + |
| 8 | +jobs: |
| 9 | + python-test: |
| 10 | + name: Python tests |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v2 |
| 17 | + with: |
| 18 | + ref: '0.150.5-lcm' |
| 19 | + |
| 20 | + - name: Run python tests |
| 21 | + run: bash .github/python-nosetests.sh |
| 22 | + |
| 23 | + ocaml-test: |
| 24 | + name: Ocaml tests |
| 25 | + runs-on: ubuntu-20.04 |
| 26 | + env: |
| 27 | + package: "xapi-xenopsd xapi-xenopsd-simulator xapi-xenopsd-cli xapi-xenopsd-xc" |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout code |
| 31 | + uses: actions/checkout@v2 |
| 32 | + with: |
| 33 | + ref: '0.150.5-lcm' |
| 34 | + |
| 35 | + - name: Pull configuration from xs-opam |
| 36 | + run: | |
| 37 | + curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/release/stockholm/lcm/tools/xs-opam-ci.env | cut -f2 -d " " > .env |
| 38 | +
|
| 39 | + - name: Load environment file |
| 40 | + id: dotenv |
| 41 | + uses: falti/dotenv-action@v0.2.6 |
| 42 | + |
| 43 | + - name: Retrieve date for cache key (year-week) |
| 44 | + id: cache-key |
| 45 | + run: echo "::set-output name=date::$(/bin/date -u "+%Y%W")" |
| 46 | + shell: bash |
| 47 | + |
| 48 | + - name: Restore opam cache |
| 49 | + id: opam-cache |
| 50 | + uses: actions/cache@v2 |
| 51 | + with: |
| 52 | + path: "~/.opam" |
| 53 | + # invalidate cache daily, gets built daily using a scheduled job |
| 54 | + key: ${{ steps.cache-key.outputs.date }}-0.150.5 |
| 55 | + |
| 56 | + - name: Use ocaml |
| 57 | + uses: avsm/setup-ocaml@v1 |
| 58 | + with: |
| 59 | + ocaml-version: ${{ steps.dotenv.outputs.ocaml_version_full }} |
| 60 | + opam-repository: ${{ steps.dotenv.outputs.repository }} |
| 61 | + |
| 62 | + - name: Update opam metadata |
| 63 | + run: | |
| 64 | + opam update |
| 65 | + opam pin add . --no-action |
| 66 | +
|
| 67 | + - name: Install external dependencies |
| 68 | + run: opam depext -u ${{ env.package }} |
| 69 | + |
| 70 | + - name: Install dependencies |
| 71 | + run: | |
| 72 | + opam upgrade |
| 73 | + opam install ${{ env.package }} --deps-only --with-test -v |
| 74 | +
|
| 75 | + - name: Build |
| 76 | + run: | |
| 77 | + opam exec -- ./configure |
| 78 | + opam exec -- make |
| 79 | +
|
| 80 | + - name: Run tests |
| 81 | + run: opam exec -- make test |
| 82 | + |
| 83 | + - name: Avoid built packages to appear in the cache |
| 84 | + # only packages in this repository follow a branch, the rest point to a tag |
| 85 | + run: opam uninstall ${{ env.package }} |
0 commit comments