Implement Data Source Registration per ADR-0006 #292
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
docker logs ${{ env.CONTAINER_RUNTIME_NAME }} | |
sleep 10s | |
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}') | |
sleep 10s | |
docker logs ${{ env.CONTAINER_RUNTIME_NAME }} | |
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" ] |