forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (107 loc) · 4.48 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Build and test
on:
push:
pull_request:
schedule:
# run daily, this refreshes the cache
- cron: '13 2 * * *'
jobs:
python-test:
name: Python tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install python 2 dependencies
if: ${{ matrix.python-version == 2.7 }}
run: pip install enum
- name: Install dependencies
run: pip install mock pytest
- name: Run python tests
run: pytest scripts
ocaml-test:
name: Ocaml tests
runs-on: ubuntu-20.04
env:
package: "xapi-cli-protocol xapi-client xapi-consts xapi-datamodel xapi-types xapi xe xen-api-sdk xen-api-client xen-api-client-lwt xen-api-client-async xapi-rrdd xapi-rrdd-plugin xapi-rrd-transport xapi-rrd-transport-utils rrd-transport rrdd-plugin rrdd-plugins rrddump gzip http-lib pciutil safe-resources sexpr stunnel uuid xapi-compression xml-light2 zstd vhd-tool xapi-networkd xapi-squeezed xapi-xenopsd xapi-xenopsd-cli xapi-xenopsd-simulator xapi-xenopsd-xc message-switch message-switch-async message-switch-cli message-switch-core message-switch-lwt message-switch-unix xapi-idl forkexec xapi-forkexecd xapi-storage xapi-storage-script xapi-storage-cli wsproxy xapi-nbd varstored-guard xapi-log xapi-open-uri vhd-format vhd-format-lwt xapi-tracing"
XAPI_VERSION: "v0.0.0-${{ github.sha }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
# The checkout action performs a shallow, this triggers dune to set the
# version to <hash>-dirty. Work around this dune behaviour and tag the
# commit so a proper version is always picked up
- name: Tag current commit
run: |
git config user.name "Dune workaround"
git config user.email "<>"
git tag -am "workaround for dune" "$XAPI_VERSION"
- name: Pull configuration from xs-opam
run: |
curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env
- name: Load environment file
id: dotenv
uses: falti/[email protected]
- name: Retrieve date for cache key
id: cache-key
run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
- name: Restore opam cache
id: opam-cache
uses: actions/cache@v3
with:
path: "~/.opam"
# invalidate cache daily, gets built daily using a scheduled job
key: ${{ steps.cache-key.outputs.date }}
- name: Use ocaml
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ steps.dotenv.outputs.ocaml_version_full }}
opam-repository: ${{ steps.dotenv.outputs.repository }}
- name: Install dependencies
run: |
opam update
opam pin add . --no-action
opam depext -u ${{ env.package }}
opam upgrade
opam install ${{ env.package }} --deps-only --with-test -v
- name: Configure
run: opam exec -- ./configure --xapi_version="$XAPI_VERSION"
- name: Build
run: opam exec -- make
- name: Run tests
run: opam exec -- make test
- name: Check all code
run: opam exec -- make check
- name: Run stress tests
run: opam exec -- make stresstest
if: ${{ github.event_name == 'schedule' }}
- name: Build SDK
run: |
mkdir -p /opt/xensource/sm
wget -O /opt/xensource/sm/XE_SR_ERRORCODES.xml https://raw.githubusercontent.com/xapi-project/sm/master/drivers/XE_SR_ERRORCODES.xml
opam exec -- make sdk
- name: Uninstall unversioned packages and remove pins
# This should purge them from the cache, unversioned package have
# 'master' as its version
run: |
opam list | awk -F " " '$2 == "master" { print $1 }' | xargs opam uninstall
opam pin list | cut -f1 -d "." | xargs opam unpin
deprecation-test:
name: Deprecation tests
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate empty configuration for make to be happy
run: touch config.mk
- name: quality-gate
run: make quality-gate