Add GHA workflow for generating WebAPI client library for Java #427
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/**' | |
- '!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 ] |