Skip to content

Release 1.4 ( .net 8 upgrade) (#518) #436

Release 1.4 ( .net 8 upgrade) (#518)

Release 1.4 ( .net 8 upgrade) (#518) #436

name: Verify Sample Azure Functions with GSF Packages
on:
push:
branches: [ dev, main ]
pull_request:
branches: [ dev, main ]
paths:
- 'src/**'
- '.github/workflows/**'
- 'samples/azure/azure-function/**'
- '!casdk-docs/**'
env:
DOCKERFILE_PATH: samples/azure/azure-function/Dockerfile
CONTAINER_IMAGE_NAME: runnable-container
CONTAINER_RUNTIME_NAME: az-func
jobs:
container_azure_function:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker RM container name
continue-on-error: true
run: docker rm -f ${{ env.CONTAINER_RUNTIME_NAME }}
# Build and tag final image, remove dangling images only if there are any
- name: Docker Target Final
run: |
docker build --no-cache . -f ${{ env.DOCKERFILE_PATH }} -t ${{ env.CONTAINER_IMAGE_NAME }}
docker images -qf dangling=true | xargs --no-run-if-empty docker rmi
- name: Docker Run Container
run: docker run -d --name ${{ env.CONTAINER_RUNTIME_NAME }} -p 8080:80 ${{ env.CONTAINER_IMAGE_NAME }}
# Request fails with authentication error. Expected
- name: Get Average Carbon Intensity
run: |
set +e
ret_code=$(wget -S -t 5 --waitretry=5 "http://0.0.0.0:8080/api/GetAverageCarbonIntensity?startDate=2022-03-01T15:30:00Z&endDate=2022-03-01T18:30:00Z&location=eastus" 2>&1 | grep "HTTP/" | awk '{print $2}')
set -e
[ "401" == $ret_code ]
# Request fails with authentication error. Expected
- name: Get Current Forecast
run: |
set +e
ret_code=$(wget -S -t 5 --waitretry=5 "http://0.0.0.0:8080/api/GetCurrentForecast" --header "Content-Type: application/json" --post-data '{"startDate":"2022-11-02T15:30:00Z","endDate":"2022-11-02T18:30:00Z","location":"eastus","duration":"15"}' 2>&1 | grep "HTTP/" | awk '{print $2}')
set -e
[ "401" == $ret_code ]