Skip to content

Implement Data Source Registration per ADR-0006 #285

Implement Data Source Registration per ADR-0006

Implement Data Source Registration per ADR-0006 #285

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
set -x
sleep 5s
curl -s -v "http://0.0.0.0:8080/api/GetAverageCarbonIntensity?startDate=2022-03-01T15:30:00Z&endDate=2022-03-01T18:30:00Z&location=eastus")
set -e
echo "Return Code: $ret_code"
[ "401" = "$ret_code" ]
# Request fails with authentication error. Expected
- name: Get Current Forecast
run: |
set +e
set -x
ret_code=$(curl -4 --retry-connrefused --retry 6 --retry-delay 10 -s -o /dev/null -w "%{response_code}" -X POST -H "Content-Type: application/json" -d '{"startDate":"2022-11-02T15:30:00Z","endDate":"2022-11-02T18:30:00Z","location":"eastus","duration":"15"}' "http://0.0.0.0:8080/api/GetCurrentForecast"
set -e
echo "Return Code: $ret_code"
[ "401" = "$ret_code" ]