Skip to content

Commit

Permalink
add api and export_config workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
FleetAdmiralButter committed Sep 21, 2023
1 parent 7e087fd commit 6895d75
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 3 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: api

on:
workflow_call:
inputs:
tag:
description: SDP testing Docker image tag
type: string
required: false
default: migration
be_url:
description: The backend URL for testing
type: string
required: true
default: "https://nginx-php.pr-1581.content-vic.sdp4.sdp.vic.gov.au/"

jobs:
api:
name: api
runs-on: biggy
container:
image: ghcr.io/dpc-sdp/bay/ci-builder:5.x
steps:
- name: Checkout code
uses: actions/checkout@v4
# GitHub Actions does not support cloning to a custom path.
- name: Copy repo
run: |
cp -R /__w/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/} /app
- name: Set up Environment variables
run: |
echo 'BE_BASE_URL=${{ inputs.be_url }}' >> $GITHUB_ENV
- name: Wake test target
run: |
curl ${BE_BASE_URL} -s -S --max-time 1000 --write-out '%{http_code}' --output /dev/null;
- name: Install dependencies
run: |
npm install -g newman newman-reporter-htmlextra
apk add jq
- name: Run core Newman API tests
run: |
cd /app
if [ -e tests/newman/tide.collection.json ]
then
if [[ ${TEST_NEWMAN_DISABLE_CORE} == true ]]
then
echo "==> Core Tests are disabled by env var TEST_NEWMAN_DISABLE_CORE. Skip the test."
else
case ${CIRCLE_BRANCH} in
standby|production)
newman run tests/newman/tide.collection.json --folder default -e tests/newman/tide.environment.json --env-var "host=${BE_BASE_URL}" --env-var "branch=${GITHUB_REF_NAME}" --color on -r htmlextra --reporter-htmlextra-export ./report/tide.collection.report.html;;
*)
newman run tests/newman/tide.collection.json -e tests/newman/tide.environment.json --env-var "host=${BE_BASE_URL}" --env-var "branch=${GITHUB_REF_NAME}" --color on -r htmlextra --reporter-htmlextra-export ./report/tide.collection.report.html;;
esac
fi
else
echo "==> No Postman API test collection is found. Skip the test."
fi
20 changes: 20 additions & 0 deletions .github/workflows/export_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: export_config

on: workflow_call

jobs:
build_tide:
name: export_config
runs-on: biggy
container:
image: ghcr.io/dpc-sdp/bay/ci-builder:5.x
steps:
- name: Checkout code
uses: actions/checkout@v4
# GitHub Actions does not support cloning to a custom path.
- name: Copy repo
run: |
cp -R /__w/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/} /app
- name: Run export script
run: |
/app/.circleci/export-config.sh
3 changes: 0 additions & 3 deletions .github/workflows/tide_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
- name: Copy repo
run: |
cp -R /__w/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/} /app
- name: List /app directory
run: |
ls -a /app
- name: Run build script
run: |
/app/.circleci/build.sh
Expand Down

0 comments on commit 6895d75

Please sign in to comment.