From 5954df2dc218b114cf0114ceef6e52624c932145 Mon Sep 17 00:00:00 2001 From: Petr Gazarov Date: Wed, 18 Oct 2023 06:59:51 -0700 Subject: [PATCH] GA: add verify compile step to windows test --- .../verify-compile/{run.sh => run_bash.sh} | 0 .../scripts/verify-compile/run_powershell.ps1 | 26 +++++++++++++++++++ .github/workflows/test_linux_install.yml | 4 +-- .github/workflows/test_macos_install.yml | 4 +-- .github/workflows/test_windows_install.yml | 9 ++++++- 5 files changed, 38 insertions(+), 5 deletions(-) rename .github/scripts/verify-compile/{run.sh => run_bash.sh} (100%) create mode 100644 .github/scripts/verify-compile/run_powershell.ps1 diff --git a/.github/scripts/verify-compile/run.sh b/.github/scripts/verify-compile/run_bash.sh similarity index 100% rename from .github/scripts/verify-compile/run.sh rename to .github/scripts/verify-compile/run_bash.sh diff --git a/.github/scripts/verify-compile/run_powershell.ps1 b/.github/scripts/verify-compile/run_powershell.ps1 new file mode 100644 index 0000000..ae4106e --- /dev/null +++ b/.github/scripts/verify-compile/run_powershell.ps1 @@ -0,0 +1,26 @@ +$ErrorActionPreference = "Stop" +$SALAMI_REPO_DIRECTORY = $args[0] + +New-Item -ItemType Directory -Force -Path .\salami +New-Item -ItemType Directory -Force -Path .\terraform +Copy-Item "${SALAMI_REPO_DIRECTORY}\.github\scripts\verify-compile\s3_bucket.sami" -Destination .\salami\s3_bucket.sami +Copy-Item "${SALAMI_REPO_DIRECTORY}\.github\scripts\verify-compile\salami.yaml" -Destination .\salami.yaml + +salami compile + +if (!(Test-Path -Path .\terraform\s3_bucket.tf)) { + Write-Host "Error: terraform\s3_bucket.tf does not exist" + exit 1 +} + +if (!(Compare-Object (Get-Content .\terraform\s3_bucket.tf) (Get-Content "${SALAMI_REPO_DIRECTORY}\.github\scripts\verify-compile\s3_bucket.tf") -Quiet)) { + Write-Host "Error: terraform\s3_bucket.tf and ${SALAMI_REPO_DIRECTORY}\.github\scripts\verify-compile\s3_bucket.tf are not the same" + + Write-Host "Contents of terraform\s3_bucket.tf:" + Get-Content .\terraform\s3_bucket.tf + + Write-Host "Contents of ${SALAMI_REPO_DIRECTORY}\.github\scripts\verify-compile\s3_bucket.tf:" + Get-Content "${SALAMI_REPO_DIRECTORY}\.github\scripts\verify-compile\s3_bucket.tf" + + exit 1 +} \ No newline at end of file diff --git a/.github/workflows/test_linux_install.yml b/.github/workflows/test_linux_install.yml index b91b66c..f859c0a 100644 --- a/.github/workflows/test_linux_install.yml +++ b/.github/workflows/test_linux_install.yml @@ -45,11 +45,11 @@ jobs: version=$(salami version) || exit 1 if [[ $version != "Salami version ${{ steps.latest-tag.outputs.tag }}" ]]; then - echo "Version mismatch. Expected: Salami v${{ steps.latest-tag.outputs.tag }}, Got: $version" + echo "Version mismatch. Expected: Salami ${{ steps.latest-tag.outputs.tag }}, Got: $version" exit 1 fi - name: Verify compile env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - run: salami-repo/.github/scripts/verify-compile/run.sh salami-repo \ No newline at end of file + run: salami-repo/.github/scripts/verify-compile/run_bash.sh salami-repo diff --git a/.github/workflows/test_macos_install.yml b/.github/workflows/test_macos_install.yml index 10e4e5a..f7b20e4 100644 --- a/.github/workflows/test_macos_install.yml +++ b/.github/workflows/test_macos_install.yml @@ -42,11 +42,11 @@ jobs: version=$(salami version) || exit 1 if [[ $version != "Salami version ${{ steps.latest-tag.outputs.tag }}" ]]; then - echo "Version mismatch. Expected: Salami v${{ steps.latest-tag.outputs.tag }}, Got: $version" + echo "Version mismatch. Expected: Salami ${{ steps.latest-tag.outputs.tag }}, Got: $version" exit 1 fi - name: Verify compile env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - run: salami-repo/.github/scripts/verify-compile/run.sh salami-repo + run: salami-repo/.github/scripts/verify-compile/run_bash.sh salami-repo diff --git a/.github/workflows/test_windows_install.yml b/.github/workflows/test_windows_install.yml index b562b9a..d02be01 100644 --- a/.github/workflows/test_windows_install.yml +++ b/.github/workflows/test_windows_install.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + with: + path: salami-repo - name: Install Chocolatey run: | @@ -28,10 +30,15 @@ jobs: $LATEST_TAG = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/latest" | Select-Object -ExpandProperty tag_name echo "tag=$LATEST_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append - - name: Verify Installation + - name: Verify version run: | $version = salami version if ($version -ne "Salami version ${{ steps.latest-tag.outputs.tag }}") { Write-Output "Version mismatch. Expected: Salami v${{ steps.latest-tag.outputs.tag }}, Got: $version" exit 1 } + + - name: Verify compile + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + run: .\salami-repo\.github\scripts\verify-compile\run_powershell.ps1 salami-repo