Skip to content

Commit ec32a20

Browse files
authored
Add Azure CLI test workflow (#17507)
Added a workflow to test Bicep CLI integration with Azure CLI edge build to capture issues that could cause failures in Bicep related Azure CLI commands. Closes #17151. ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/17507)
1 parent 832926c commit ec32a20

File tree

3 files changed

+112
-2
lines changed

3 files changed

+112
-2
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+

.github/workflows/update-dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
run: |
3030
npm install -g npm-check-updates
3131
dotnet tool install -g dotnet-outdated-tool
32-
32+
3333
- name: Update Dependencies
3434
continue-on-error: true
3535
run: ./scripts/update_dependencies.sh
36-
36+
3737
- name: Create Pull Request
3838
uses: peter-evans/create-pull-request@v7
3939
with:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Build](https://github.com/Azure/bicep/actions/workflows/build.yml/badge.svg)](https://github.com/Azure/bicep/actions/workflows/build.yml)
2+
[![Test Azure CLI Integration](https://github.com/Azure/bicep/actions/workflows/test-azure-cli-integration.yml/badge.svg?branch=main)](https://github.com/Azure/bicep/actions/workflows/test-azure-cli-integration.yml)
23
[![codecov](https://codecov.io/gh/Azure/bicep/branch/main/graph/badge.svg)](https://app.codecov.io/gh/Azure/bicep/tree/main)
34
[![Needs Upvote](https://img.shields.io/github/issues/Azure/Bicep/Needs%3A%20Upvote?color=green&label=Needs%3A%20Upvote&style=flat)](https://github.com/Azure/bicep/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs%3A+Upvote%22+sort%3Areactions-%2B1-asc)
45
[![Good First Issues](https://img.shields.io/github/issues/Azure/Bicep/good%20first%20issue?color=blue&label=good%20first%20issue&style=flat)](https://github.com/Azure/Bicep/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)

0 commit comments

Comments
 (0)