From 3d2738e3295c2a915764351700db6ac3cb3e43f3 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Wed, 14 Feb 2024 08:39:34 -0500 Subject: [PATCH] Add and use `cleanup-xapi-environment` composite action Signed-off-by: Danilo Del Busso --- .../workflows/cleanup-xapi-environment/action.yml | 13 +++++++++++++ .github/workflows/generate-and-build-sdks.yml | 11 +++++++---- .github/workflows/main.yml | 10 +++------- .github/workflows/setup-xapi-environment/action.yml | 2 +- 4 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/cleanup-xapi-environment/action.yml diff --git a/.github/workflows/cleanup-xapi-environment/action.yml b/.github/workflows/cleanup-xapi-environment/action.yml new file mode 100644 index 00000000000..96323007e4e --- /dev/null +++ b/.github/workflows/cleanup-xapi-environment/action.yml @@ -0,0 +1,13 @@ +name: Cleanup XenAPI environment +description: Cleanup XenAPI environment created using the setup-xapi-environment composite action + +runs: + using: "composite" + steps: + - name: Uninstall unversioned packages and remove pins + shell: bash + # 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 diff --git a/.github/workflows/generate-and-build-sdks.yml b/.github/workflows/generate-and-build-sdks.yml index c5bff2cad77..6a58aa6ce83 100644 --- a/.github/workflows/generate-and-build-sdks.yml +++ b/.github/workflows/generate-and-build-sdks.yml @@ -36,13 +36,16 @@ jobs: name: SDK_Source_PowerShell path: _build/install/default/xapi/sdk/powershell/* + - name: Cleanup XenAPI environment + uses: ./.github/workflows/cleanup-xapi-environment + build-csharp-sdk: name: Build C# SDK runs-on: windows-2022 needs: generate-sdk-sources - steps: + steps: - name: Strip 'v' prefix from xapi version - shell : pwsh + shell: pwsh run: echo "XAPI_VERSION_NUMBER=$("${{ inputs.xapi_version }}".TrimStart('v'))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Retrieve C# SDK source @@ -74,7 +77,7 @@ jobs: runs-on: windows-2019 steps: - name: Strip 'v' prefix from xapi version - shell : pwsh + shell: pwsh run: echo "XAPI_VERSION_NUMBER=$("${{ inputs.xapi_version }}".TrimStart('v'))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Retrieve PowerShell SDK source @@ -148,7 +151,7 @@ jobs: steps: - name: Strip 'v' prefix from xapi version - shell : pwsh + shell: pwsh run: echo "XAPI_VERSION_NUMBER=$("${{ inputs.xapi_version }}".TrimStart('v'))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Retrieve PowerShell SDK source diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6400d6cc97d..3f077bbf3b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -143,12 +143,8 @@ jobs: - name: Check disk space run: df -h || true - - 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 + - name: Cleanup XenAPI environment + uses: ./.github/workflows/cleanup-xapi-environment deprecation-test: name: Deprecation tests @@ -172,7 +168,7 @@ jobs: level: error test-sdk-builds: - name: Test SDK builds + name: Test SDK builds uses: ./.github/workflows/generate-and-build-sdks.yml with: # Ensure you also update ocaml-tests diff --git a/.github/workflows/setup-xapi-environment/action.yml b/.github/workflows/setup-xapi-environment/action.yml index ca0863dfe32..702162d42f3 100644 --- a/.github/workflows/setup-xapi-environment/action.yml +++ b/.github/workflows/setup-xapi-environment/action.yml @@ -18,7 +18,7 @@ runs: curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env - name: Download XE_SR_ERRORCODES.xml - shell : bash + 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