Skip to content

added ncpu keyword to vmtemplate #275

added ncpu keyword to vmtemplate

added ncpu keyword to vmtemplate #275

Workflow file for this run

name: CI
on:
push:
branches: [master]
tags: ["*"]
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- 1.6
- 1
os:
- ubuntu-latest
arch:
- x64
env:
TENANT_ID: "${{ secrets.TENANT_ID }}"
SUBSCRIPTION_ID: "${{ secrets.SUBSCRIPTION_ID }}"
RESOURCE_GROUP: "AzureBackupRG-azman-${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}"
CLIENT_ID: "${{ secrets.CLIENT_ID }}"
CLIENT_SECRET: "${{ secrets.CLIENT_SECRET }}"
GALLERY_NAME: "${{ github.run_id }}${{ matrix.version }}gallery"
IMAGE_NAME: "${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}-image"
VM_NAME: "${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}-vm"
PUBLIC_IP_NAME: "${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}-pubip"
VNET_NAME: "${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}-vnet"
NSG_NAME: "${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}-nsg"
SUBNET_NAME: "default"
COMMIT_SHA: "${{ github.sha }}"
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- name: Create an SSH Key Pair
run: ssh-keygen -f /home/runner/.ssh/azmanagers_rsa -N ''
- name: Create Prereq. Azure Resources
run: |
az login --service-principal -u "$CLIENT_ID" -p "$CLIENT_SECRET" -t "$TENANT_ID"
az group create -g "$RESOURCE_GROUP" -l southcentralus --tags "CostElement=YWED10528906" "CompanyCode=0322" "environment=dev" "[email protected]"
az group wait -g "$RESOURCE_GROUP" --created
az sig create -g "$RESOURCE_GROUP" -r "$GALLERY_NAME"
az sig image-definition create -g "$RESOURCE_GROUP" -r "$GALLERY_NAME" -i "$IMAGE_NAME" -p "canonical" -f "0001-com-ubuntu-server-jammy" -s "22_04-lts-gen2" --os-type linux --hyper-v-generation V2
az network nsg create -g "$RESOURCE_GROUP" -n "$NSG_NAME"
az network nsg rule create -g "$RESOURCE_GROUP" -n "rule-$NSG_NAME" --nsg-name "$NSG_NAME" --priority 101 --source-address-prefixes "AzureCloud" --destination-port-ranges 22
az network vnet create -g "$RESOURCE_GROUP" -n "$VNET_NAME" --subnet-name "$SUBNET_NAME"
az network vnet subnet update -g "$RESOURCE_GROUP" -n "$SUBNET_NAME" --vnet-name "$VNET_NAME" --network-security-group "$NSG_NAME"
- name: Install Packer
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer
- name: Build Packer Image
run: |
export JULIA_VERSION_MAJOR=$(julia -e 'print(stdout, VERSION.major)')
export JULIA_VERSION_MINOR=$(julia -e 'print(stdout, VERSION.minor)')
export JULIA_VERSION_PATCH=$(julia -e 'print(stdout, VERSION.patch)')
packer init ${GITHUB_WORKSPACE}/test/image.pkr.hcl
packer build -color=false -timestamp-ui \
-var "subscription_id=${SUBSCRIPTION_ID}" \
-var "tenant_id=${TENANT_ID}" \
-var "client_id=${CLIENT_ID}" \
-var "client_secret=${CLIENT_SECRET}" \
-var "resource_group=${RESOURCE_GROUP}" \
-var "image_name=${IMAGE_NAME}" \
-var "virtual_network=${VNET_NAME}" \
-var "virtual_subnet=default" \
-var "gallery=${GALLERY_NAME}" \
-var "julia_version_major=${JULIA_VERSION_MAJOR}" \
-var "julia_version_minor=${JULIA_VERSION_MINOR}" \
-var "julia_version_patch=${JULIA_VERSION_PATCH}" \
-var "azmanagers_version=${{ github.sha }}" \
${GITHUB_WORKSPACE}/test/image.pkr.hcl
- name: Create coordinator VM
run: |
az vm create -g "$RESOURCE_GROUP" -n "$VM_NAME" --image "$IMAGE_NAME" --public-ip-sku Standard --public-ip-address "$PUBLIC_IP_NAME" --subnet "$SUBNET_NAME" --vnet-name "$VNET_NAME" --nsg "$NSG_NAME" --ssh-key-values @/home/runner/.ssh/azmanagers_rsa.pub --admin-username cvx
- name: Run the unit tests
run: |
echo "Grabbing the coordinator VM's Pubic IP Address..."
ipaddress=$(az network public-ip show -g "$RESOURCE_GROUP" -n "$PUBLIC_IP_NAME" | jq '.ipAddress' | cut -d "\"" -f 2)
echo ""
echo "Running the Unit Tests and Code Coverage..."
ssh -o StrictHostKeyChecking=no -i /home/runner/.ssh/azmanagers_rsa cvx@$ipaddress "julia -e 'using Pkg; Pkg.test(\"AzManagers\"; coverage=true); using AzManagers; include(joinpath(pkgdir(AzManagers), \"test\", \"julia-codecov.jl\"))'"
echo ""
echo "scp-ing the Coverage Report..."
scp -o StrictHostKeyChecking=no -i /home/runner/.ssh/azmanagers_rsa cvx@$ipaddress:/home/cvx/lcov.info lcov.info
- uses: codecov/codecov-action@v1
with:
file: lcov.info
- name: Delete CI Resource Group
run: |
az group delete -n "$RESOURCE_GROUP" --yes
if: ${{ always() }}
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}