|
| 1 | +name: Test Azure CLI Integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - .github/workflows/test-azure-cli-integration.yml |
| 9 | + - src/Bicep.Cli/** |
| 10 | + - src/Bicep.Core/** |
| 11 | + - src/Bicep.Decompiler/** |
| 12 | + - src/Bicep.IO/** |
| 13 | + - src/Bicep.Local.Deploy/** |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + publish-bicep-cli: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. |
| 24 | + submodules: true |
| 25 | + |
| 26 | + - name: Setup .NET Core |
| 27 | + uses: actions/setup-dotnet@v4 |
| 28 | + |
| 29 | + - name: Publish Bicep CLI |
| 30 | + run: dotnet publish --configuration release --self-contained true -r linux-x64 ./src/Bicep.Cli/Bicep.Cli.csproj |
| 31 | + |
| 32 | + - name: Upload Bicep |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: bicep-release-linux-x64 |
| 36 | + path: ./src/Bicep.Cli/bin/release/net8.0/linux-x64/publish/* |
| 37 | + if-no-files-found: error |
| 38 | + |
| 39 | + |
| 40 | + test-azure-cli-integration: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: publish-bicep-cli |
| 43 | + steps: |
| 44 | + - name: Install Azure CLI Edge Build |
| 45 | + run: | |
| 46 | + set -e |
| 47 | +
|
| 48 | + echo "Downloading Azure CLI Edge build..." |
| 49 | + curl --location --silent --output azure-cli_jammy.deb https://aka.ms/InstallAzureCliJammyEdge |
| 50 | +
|
| 51 | + echo "Installing Azure CLI Edge build..." |
| 52 | + sudo dpkg -i azure-cli_jammy.deb |
| 53 | +
|
| 54 | + echo "Verifying Azure CLI Edge build version..." |
| 55 | + az version |
| 56 | +
|
| 57 | + - name: Test Azure CLI Edge Build with Pre-installed Bicep CLI |
| 58 | + run: | |
| 59 | + set -e |
| 60 | +
|
| 61 | + az config set bicep.use_binary_from_path=true |
| 62 | + az config get bicep.use_binary_from_path |
| 63 | + az bicep version |
| 64 | +
|
| 65 | + echo "var message = 'Hello, world!'" > hello-world.bicep |
| 66 | + az bicep build --file hello-world.bicep --debug |
| 67 | +
|
| 68 | + - name: Test Azure CLI Edge Build with the Latest Published Bicep CLI Version |
| 69 | + run: | |
| 70 | + set -e |
| 71 | +
|
| 72 | + az config set bicep.use_binary_from_path=false |
| 73 | + az config get bicep.use_binary_from_path |
| 74 | +
|
| 75 | + az bicep install |
| 76 | + az bicep version |
| 77 | +
|
| 78 | + echo "var message = 'Hello, world!'" > hello-world.bicep |
| 79 | + az bicep build --file hello-world.bicep --debug |
| 80 | +
|
| 81 | + - name: Uninstall Bicep CLI |
| 82 | + run: | |
| 83 | + az bicep uninstall |
| 84 | +
|
| 85 | +
|
| 86 | + - name: Download Current Bicep CLI Build |
| 87 | + uses: actions/download-artifact@v4 |
| 88 | + with: |
| 89 | + name: bicep-release-linux-x64 |
| 90 | + path: ~/.azure/bin |
| 91 | + |
| 92 | + - name: Set Bicep CLI executable permissions |
| 93 | + run: chmod +x ~/.azure/bin/bicep |
| 94 | + |
| 95 | + - name: Test Azure CLI Edge Build with the Current Bicep CLI Build |
| 96 | + run: | |
| 97 | + set -e |
| 98 | +
|
| 99 | + az config set bicep.use_binary_from_path=false |
| 100 | + az config get bicep.use_binary_from_path |
| 101 | +
|
| 102 | + az bicep version |
| 103 | +
|
| 104 | + echo "var message = 'Hello, world!'" > hello-world.bicep |
| 105 | + az bicep build --file hello-world.bicep --debug |
| 106 | +
|
| 107 | +
|
| 108 | +
|
| 109 | +
|
0 commit comments