Update readme #854
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: Build | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Set up Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '10' | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Build frontend | |
run: | | |
npm install | |
npx gulp buildAll | |
- name: Build backend and test | |
run: | | |
chmod +x gradlew | |
./gradlew test bootJar | |
- name: Detached run test app | |
run: | | |
./gradlew bootRun & | |
# Wait up to 30s for the app to start | |
- name: Wait for test app start | |
run: | | |
export START_TIME=$(date +%s) | |
until curl http://localhost:8080/health > /dev/null || test "$(($(date +%s) - $START_TIME))" -gt 30; do sleep 5 | echo "Waiting..."; done | |
shell: bash | |
- name: Run OpenAPI tests | |
run: | | |
pip install schemathesis | |
schemathesis run --hypothesis-phases=explicit http://localhost:8080/api/v1/energy-labels-openapi.json | |
# - name: Install cf client | |
# env: | |
# CF_CLI_VERSION: v6 | |
# run: | | |
# mkdir -p $GITHUB_WORKSPACE/bin | |
# curl -L "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${CF_CLI_VERSION}" | tar -zx -C $GITHUB_WORKSPACE/bin | |
# echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
# | |
# - name: Deploy QA | |
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/qa' }} | |
# env: | |
# CF_USERNAME: ${{ secrets.CF_USERNAME }} | |
# CF_PASSWORD: ${{ secrets.CF_PASSWORD }} | |
# run: | | |
# cf api api.london.cloud.service.gov.uk | |
# cf auth | |
# cf target -o beis-energy-label-service -s energy-label-service-qa | |
# cf push -f manifest-qa.yml | |
# cf logout | |
# | |
# - name: Deploy prod | |
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
# env: | |
# API: api.london.cloud.service.gov.uk | |
# APP: energy-label-service-prod | |
# ORG: beis-energy-label-service | |
# SPACE: energy-label-service-prod | |
# MANIFEST: manifest-prod.yml | |
# SMOKE_TEST: ci/smoke-test.sh | |
# DELETE_OLD_APPS: true | |
# USER: ${{ secrets.CF_USERNAME }} | |
# CF_PASS: ${{ secrets.CF_PASSWORD }} | |
# run: | | |
# chmod +x ci/blue-green-deploy.sh | |
# chmod +x ci/smoke-test.sh | |
# ci/blue-green-deploy.sh |