diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cadf84c35c4..f661b34e6ce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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,12 +18,12 @@ 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}} @@ -31,8 +31,8 @@ jobs: - 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" @@ -103,55 +103,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/dotenv-action@v1.0.4 - - - 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 @@ -166,21 +132,11 @@ 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: 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 @@ -211,3 +167,9 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-review level: error + + test-sdk-builds: + name: Test SDK builds + uses: ./.github/workflows/generate-and-build-sdks.yml + with: + xapi_version: "0.0.0" diff --git a/Makefile b/Makefile index bcfc5b9eb78..7b5d6cb8703 100644 --- a/Makefile +++ b/Makefile @@ -112,11 +112,6 @@ sdk: sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/csharp sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/powershell -# workaround for no .resx generation, just for compilation testing -sdksanity: sdk - sed -i 's/FriendlyErrorNames.ResourceManager/null/g' ./_build/install/default/xapi/sdk/csharp/src/Failure.cs - cd _build/install/default/xapi/sdk/csharp/src && dotnet add package Newtonsoft.Json && dotnet build -f netstandard2.0 - .PHONY: sdk-build-java sdk-build-java: sdk