generated from graasp/graasp-repo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: update app for typeorm * refactor: add renovate config * refactor: handle public scenario
- Loading branch information
Showing
89 changed files
with
6,239 additions
and
4,781 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,89 @@ | ||
name: Cypress | ||
name: cypress tests | ||
|
||
# Control when the action will run | ||
on: | ||
# Triggers the workflow on push events except for the main branch | ||
push: | ||
branches-ignore: | ||
- 'release-please-**' | ||
|
||
# This workflow is made up of one job that calls the reusable workflow in graasp-deploy | ||
jobs: | ||
graasp-deploy-cypress-workflow: | ||
# Replace with repository name | ||
name: Graasp app quiz | ||
# Replace 'main' with the hash of a commit, so it points to an specific version of the reusable workflow that is used | ||
# Reference reusable workflow file. Using the commit SHA is the safest for stability and security | ||
uses: graasp/graasp-deploy/.github/workflows/cypress.yml@v1 | ||
# Insert required inputs based on repository | ||
with: | ||
# Test values | ||
node-env-test: test | ||
graasp-domain-test: localhost | ||
graasp-app-id-test: id-1234567890 | ||
enable-mock-api-test: true | ||
# Insert required secrets based on repository with the following format: ${{ secrets.SECRET_NAME }} | ||
secrets: | ||
api-host-test: ${{ secrets.REACT_APP_API_HOST_TEST }} | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: set up node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Yarn Install and Cache | ||
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | ||
with: | ||
cypress: true | ||
|
||
- name: cypress run | ||
uses: cypress-io/github-action@v5 | ||
env: | ||
REACT_APP_API_HOST: http://localhost:3636 | ||
REACT_APP_GRAASP_DOMAIN: localhost | ||
REACT_APP_GRAASP_APP_KEY: id-1234567890 | ||
REACT_APP_ENABLE_MOCK_API: true | ||
NODE_ENV: test | ||
with: | ||
install: false | ||
build: yarn build | ||
config: baseUrl=http://localhost:3000 | ||
start: yarn start:ci | ||
wait-on: 'http://localhost:3000' | ||
wait-on-timeout: 180 | ||
browser: chrome | ||
quiet: true | ||
# point to new cypress@10 config file | ||
config-file: cypress.config.ts | ||
|
||
# component tests are not running ok in the CI | ||
# - name: Run Component tests 🧪 | ||
# uses: cypress-io/github-action@v4 | ||
# with: | ||
# # we have already installed everything | ||
# install: false | ||
# # to run component tests we need to use "component: true" | ||
# component: true | ||
|
||
# after the test run completes | ||
# store videos and any screenshots | ||
# NOTE: screenshots will be generated only if E2E test failed | ||
# thus we store screenshots only on failures | ||
# Alternative: create and commit an empty cypress/screenshots folder | ||
# to always have something to upload | ||
- uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: cypress-videos | ||
path: cypress/videos | ||
|
||
- name: coverage report | ||
run: npx nyc report --reporter=text-summary | ||
|
||
- name: coverage commit status | ||
run: | | ||
total=$(cat coverage/coverage-summary.json | jq .total.lines.pct) | ||
echo Total coverage ${total} | ||
curl -S -s \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
https://api.github.com/repos/${REPO_PATH}/statuses/${COMMIT_SHA} \ | ||
-d "{\"state\":\"success\",\"target_url\":\"https://github.com/${REPO_PATH}/actions/runs/${RUN_ID}\",\"description\":\"${total}%\",\"context\":\"code-coverage\"}" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
REPO_PATH: ${{ github.repository }} | ||
COMMIT_SHA: ${{ github.sha }} | ||
RUN_ID: ${{ github.run_id }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Automate releases of new app versions | ||
name: Release new app version | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: node | ||
# TODO: replace this with your app name | ||
package-name: graasp-app-quiz | ||
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"test","section":"Tests","hidden":false}]' | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
# creates minor and major tags that follow the latest release | ||
- name: Tag major and minor versions | ||
uses: jacobsvante/[email protected] | ||
if: ${{ steps.release.outputs.release_created }} | ||
with: | ||
major: ${{ steps.release.outputs.major }} | ||
minor: ${{ steps.release.outputs.minor }} | ||
|
||
# put created tag in an env variable to be sent to the dispatch | ||
- name: Set tag | ||
if: ${{ steps.release.outputs.release_created }} | ||
id: set-tag | ||
run: | | ||
REPOSITORY=$(echo '${{ github.repository }}') | ||
TAG=$(echo '${{ steps.release.outputs.tag_name }}') | ||
JSON=$(jq -c --null-input --arg repository "$REPOSITORY" --arg tag "$TAG" '{"repository": $repository, "tag": $tag}') | ||
echo "json=$JSON" >> $GITHUB_OUTPUT | ||
# Trigger an 'on: repository_dispatch' workflow to run in graasp-deploy repository | ||
- name: Push tag to Graasp Deploy (Staging) | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
repository: graasp/graasp-deploy | ||
event-type: update-staging-version | ||
client-payload: ${{ steps.set-tag.outputs.json }} | ||
|
||
- name: Auto Tag | ||
id: auto-tag | ||
if: ${{ steps.release.outputs.releases_created }} | ||
run: | | ||
gh label create ${{ env.TAG_NAME }} -f --color 0E8A16 --repo ${{ env.REPO }}; | ||
echo '### `${{ env.TAG_NAME }}` :rocket:' >> $GITHUB_STEP_SUMMARY; | ||
echo 'Tag all ${{ env.PRE_LABEL_NAME }} issues and prs as ${{ env.TAG_NAME }}'; | ||
for cmd in issue pr; | ||
do | ||
for nbr in $(gh $cmd list -l ${{ env.PRE_LABEL_NAME }} -s all --json number --jq '.[].number' --repo ${{ env.REPO }} ); | ||
do | ||
URL=$(gh $cmd edit $nbr --add-label ${{ env.TAG_NAME }} --remove-label ${{ env.PRE_LABEL_NAME }} --repo ${{ env.REPO }} ); | ||
echo "- $cmd #$nbr $URL" >> $GITHUB_STEP_SUMMARY; | ||
done | ||
done | ||
echo '' >> $GITHUB_STEP_SUMMARY; | ||
echo ':rocket: All related issues and prs tagged !' >> $GITHUB_STEP_SUMMARY; | ||
echo ':scroll: Check out [the created release](${{ env.RELEASE_URL }}) !' >> $GITHUB_STEP_SUMMARY; | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
TAG_NAME: ${{ steps.release.outputs.tag_name }} | ||
PRE_LABEL_NAME: un-released | ||
REPO: ${{ github.event.repository.full_name }} | ||
RELEASE_URL: ${{ github.event.repository.html_url }}/releases/tag/${{ steps.release.outputs.tag_name }} |
Oops, something went wrong.