This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
Build, Test, and Release #1052
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, Test, and Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [release] | |
# run daily at 08:00am UTC (on the default or base branch) | |
# https://crontab.guru/#0_8_*_*_* | |
schedule: | |
- cron: "0 8 * * *" | |
jobs: | |
build-test-release: | |
# Run only from the original repository | |
# Because this job requires secrets, which cannot be shared with forks | |
if: github.repository == 'Qiskit/platypus' | |
name: Build, Test, and Release | |
runs-on: ubuntu-latest | |
env: | |
NODE_OPTIONS: --max-old-space-size=8192 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
cache: "npm" | |
# overwrite "prepare" script in deployment since git hooks are not needed | |
- run: npm set-script prepare "" | |
- run: npm ci | |
- name: Install Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Load pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: py-${{ hashFiles('converter/textbook-converter/requirements.txt') }}-${{ hashFiles('converter/textbook-converter/requirements-test.txt') }} | |
- name: Install Python dependencies | |
run: pip install -r converter/textbook-converter/requirements.txt -r converter/textbook-converter/requirements-test.txt | |
- name: Secrets | |
run: npm run setup:secrets -- --mongo "${{ secrets.PRODUCTION_MONGODB_URI }}" --ibmClientId "${{ secrets.PRODUCTION_IBMID_CLIENT_ID }}" --ibmClientSecret "${{ secrets.PRODUCTION_IBMID_CLIENT_SECRET }}" --googleClientId "${{ secrets.PRODUCTION_GOOGLE_CLIENT_ID }}" --googleClientSecret "${{ secrets.PRODUCTION_GOOGLE_CLIENT_SECRET }}" | |
- name: Build | |
run: npm run build | |
- name: Cypress tests | |
uses: cypress-io/github-action@v2 | |
with: | |
start: npm start | |
wait-on: "http://localhost:8080/health" | |
# We remove the Dockerfile because when there is a Dockerfile in the | |
# current directory, Google App Engine try to use it. | |
- name: Remove Dockerfile | |
run: rm -f Dockerfile | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v0 | |
with: | |
credentials_json: ${{ secrets.GCLOUD_SERVICE_ACCOUNT }} | |
- name: Deploy to App Engine | |
env: | |
CLOUDSDK_APP_CLOUD_BUILD_TIMEOUT: 1800 | |
uses: google-github-actions/deploy-appengine@v0 | |
with: | |
# The GCLOUD_SERVICE_ACCOUNT secret is defined in the GitHub repo. | |
# It needs the following permissions | |
# - roles/appengine.appAdmin | |
# - roles/iam.serviceAccountUser | |
# - roles/compute.storageAdmin | |
# - cloudbuild.builds.editor | |
deliverables: app.yaml | |
# qiskit-web is the Google Cloud App ID provided by Mathigon | |
project_id: qiskit-web |