Skip to content

Implement Data Source Registration per ADR-0006 #293

Implement Data Source Registration per ADR-0006

Implement Data Source Registration per ADR-0006 #293

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/**'
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 }}
- name: Docker Target Final
run: |
docker build --no-cache . -f ${{ env.DOCKERFILE_PATH }} -t ${{ env.CONTAINER_IMAGE_NAME }}
docker image prune -f
- name: Docker Run Container
run: |
docker run -d --name ${{ env.CONTAINER_RUNTIME_NAME }} -p 8080:80 ${{ env.CONTAINER_IMAGE_NAME }}
timeout 30 bash -c -- 'while [ -z "$(docker ps -q)" ]; do echo "waiting for container to start" && sleep 5s; done'
docker ps
# Request fails with authentication error. Expected
- name: Get Average Carbon Intensity
run: |
set +e
ret_code=$(wget --server-response "http://0.0.0.0:8080/api/GetAverageCarbonIntensity?startDate=2022-03-01T15:30:00Z&endDate=2022-03-01T18:30:00Z&location=eastus" 2>&1 | awk '/^ HTTP/{print $2}')
echo "Return Code: $ret_code"
set -e
[ "401" = "$ret_code" ]
# Request fails with authentication error. Expected
- name: Get Current Forecast
run: |
set +e
ret_code=$(wget --server-response "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 | awk '/^ HTTP/{print $2}')
echo "Return Code: $ret_code"
set -e
[ "401" = "$ret_code" ]