-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SDK generation and build workflows
Also: - Reformat `yml` files - Extract XenAPI env setup into composite action - Create composite action to generate and build SDKs - Add build of C# SDK Signed-off-by: Danilo Del Busso <[email protected]>
- Loading branch information
1 parent
510997a
commit 127e29e
Showing
4 changed files
with
107 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Genrate and build SDKs | ||
description: Generate and build SDKs (excl. Python). Currently only builds the C# SDK. Ensure you are running this action after setting up a XenAPI environment. | ||
|
||
inputs: | ||
xapi_version: | ||
description: "XenAPI version. e.g.: v24.1.0" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name : Set env variables | ||
shell : bash | ||
run: echo "XAPI_VERSION=${{inputs.xapi_version}}" >> $XAPI_VERSION | ||
|
||
- name: Set up dotnet CLI | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: "6" | ||
|
||
- name: Generate SDKs | ||
shell: bash | ||
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: Build .NET SDK | ||
shell: bash | ||
run: opam exec -- make build-csharp-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ on: | |
pull_request: | ||
schedule: | ||
# run daily, this refreshes the cache | ||
- cron: '13 2 * * *' | ||
- cron: "13 2 * * *" | ||
|
||
concurrency: # On new push, cancel old workflows from the same PR, branch or tag: | ||
concurrency: # On new push, cancel old workflows from the same PR, branch or tag: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
@@ -18,21 +18,21 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['2.7', '3.11'] | ||
python-version: ["2.7", "3.11"] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # To check which files changed: origin/master..HEAD | ||
fetch-depth: 0 # To check which files changed: origin/master..HEAD | ||
- uses: LizardByte/setup-python-action@master | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
|
||
- uses: actions/cache@v3 | ||
name: Setup cache for running pre-commit fast | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
path: ~/.cache/pre-commit | ||
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- run: echo "::add-matcher::.github/workflows/python-warning-matcher.json" | ||
name: "Setup GitHub for reporting Python warnings as annotations in pull request code review" | ||
|
@@ -99,55 +99,21 @@ jobs: | |
# Fails for user workflows without permissions(fork-based pull requests): | ||
continue-on-error: true | ||
with: | ||
message-path: .git/pytype-summary.md # Add the content of it as comment | ||
message-path: .git/pytype-summary.md # Add the content of it as comment | ||
|
||
ocaml-test: | ||
name: Ocaml tests | ||
ocaml-tests: | ||
name: Run OCaml tests | ||
runs-on: ubuntu-20.04 | ||
env: | ||
XAPI_VERSION: "v0.0.0" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Free space | ||
run: sudo rm -rf /usr/local/lib/android | ||
|
||
- 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: Update Ubuntu repositories | ||
run: sudo apt-get update | ||
|
||
- name: Use disk with more space for TMPDIR and XDG_CACHE_HOME | ||
run: | | ||
df -h || true | ||
export TMPDIR="/mnt/build/tmp" | ||
export XDG_CACHE_HOME="/mnt/build/cache" | ||
sudo mkdir -p "${TMPDIR}" "${XDG_CACHE_HOME}" | ||
sudo chown "$(id -u):$(id -g)" "${TMPDIR}" "${XDG_CACHE_HOME}" | ||
echo "TMPDIR=${TMPDIR}" >>"$GITHUB_ENV" | ||
echo "XDG_CACHE_HOME=${XDG_CACHE_HOME}" >>"$GITHUB_ENV" | ||
- name: Use ocaml | ||
uses: ocaml/setup-ocaml@v2 | ||
- name: Setup XenAPI environment | ||
uses: ./.github/workflows/setup-xapi-environment | ||
with: | ||
ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }} | ||
opam-repositories: | | ||
xs-opam: ${{ steps.dotenv.outputs.repository }} | ||
dune-cache: true | ||
|
||
- name: Install dependencies | ||
run: opam install . --deps-only --with-test -v | ||
|
||
- name: Configure | ||
run: opam exec -- ./configure --xapi_version="$XAPI_VERSION" | ||
xapi_version: ${{ env.XAPI_VERSION }} | ||
|
||
- name: Build | ||
run: opam exec -- make | ||
|
@@ -162,21 +128,16 @@ jobs: | |
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: Generate and build SDKs | ||
uses: ./.github/workflows/generate-and-build-sdks | ||
with: | ||
xapi_version: ${{ env.XAPI_VERSION }} | ||
|
||
- name: Make install smoketest | ||
run: | | ||
opam exec -- make install DESTDIR=$(mktemp -d) | ||
opam exec -- make install DESTDIR=$(mktemp -d) BUILD_PY2=NO | ||
- name: Sanity test SDK | ||
run: | | ||
opam exec -- make sdksanity | ||
- name: Check disk space | ||
run: df -h || true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Setup XenAPI environment | ||
description: Setup a XenAPI environment for making opam calls. | ||
|
||
inputs: | ||
xapi_version: | ||
description: "XenAPI version, pass to configure as --xapi_version=<value>" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Free space | ||
shell: bash | ||
run: sudo rm -rf /usr/local/lib/android | ||
|
||
- name: Pull configuration from xs-opam | ||
shell: bash | ||
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: Update Ubuntu repositories | ||
shell: bash | ||
run: sudo apt-get update | ||
|
||
- name: Use disk with more space for TMPDIR and XDG_CACHE_HOME | ||
shell: bash | ||
run: | | ||
df -h || true | ||
export TMPDIR="/mnt/build/tmp" | ||
export XDG_CACHE_HOME="/mnt/build/cache" | ||
sudo mkdir -p "${TMPDIR}" "${XDG_CACHE_HOME}" | ||
sudo chown "$(id -u):$(id -g)" "${TMPDIR}" "${XDG_CACHE_HOME}" | ||
echo "TMPDIR=${TMPDIR}" >>"$GITHUB_ENV" | ||
echo "XDG_CACHE_HOME=${XDG_CACHE_HOME}" >>"$GITHUB_ENV" | ||
- name: Use ocaml | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }} | ||
opam-repositories: | | ||
xs-opam: ${{ steps.dotenv.outputs.repository }} | ||
dune-cache: true | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: opam install . --deps-only --with-test -v | ||
|
||
- name: Configure | ||
shell: bash | ||
run: opam exec -- ./configure --xapi_version="${{ inputs.xapi_version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters