feat: added github CIs
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: User story
|
||||
about: Write a user story for the team
|
||||
title: "[Story]"
|
||||
labels: story
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
## User story summary
|
||||
[Definition](#Definition)
|
||||
[Business case](#Business-case)
|
||||
[Criteria](#criteria)
|
||||
[UI/UX Design](#UI-UX-design)
|
||||
[Notes](#notes)
|
||||
[Related](#related)
|
||||
|
||||
|
||||
## Definition
|
||||
```gherkin
|
||||
Given I am
|
||||
When I look to
|
||||
And I go to XXXX page
|
||||
And I choose to
|
||||
Then I save
|
||||
And
|
||||
```
|
||||
|
||||
## Business case
|
||||
|
||||
## Criteria
|
||||
- [ ]
|
||||
|
||||
## UI UX Design
|
||||
|
||||
## Notes
|
||||
|
||||
## Related
|
||||
@@ -0,0 +1,39 @@
|
||||
name: backend-build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/backend/node/**"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Prettier code style check
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint:prettier
|
||||
- name: Lint
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build-test
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run build
|
||||
- name: unit-test
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run test:unit
|
||||
- name: e2e-mongo-test
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:e2e
|
||||
- name: e2e-cassandra-test
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml up -d scylladb elasticsearch rabbitmq && sleep 60 && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=elasticsearch -e DB_DRIVER=cassandra node npm run test:e2e
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: cd twake && mv docker-compose.tests.yml docker-compose.yml
|
||||
- run: cd twake && docker-compose up -d
|
||||
- run: cd twake && docker-compose exec -T php php composer.phar install
|
||||
- run: cd twake && docker-compose exec -T php php bin/console twake:schema:update #Test if scylla is live
|
||||
- run: cd twake && docker-compose exec -T php php bin/console twake:mapping #Test if es is live
|
||||
- run: cd twake && docker-compose exec -T php php bin/console twake:init #Test in we can do things
|
||||
@@ -0,0 +1,29 @@
|
||||
name: backend-coverage
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [assigned, opened, synchronize, reopened]
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/backend/node/**"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "refs/pull/${{ github.event.number }}/merge"
|
||||
- name: unit-test
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run test:unit
|
||||
- name: e2e-mongo-test
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:e2e
|
||||
- name: generate coverage summary json
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run test:merge:json
|
||||
- name: generate coverage summary text
|
||||
run: cd twake && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run test:merge:text
|
||||
- name: Jest Coverage Comment
|
||||
uses: MishaKav/jest-coverage-comment@main
|
||||
with:
|
||||
coverage-summary-path: twake/coverage/merged/coverage-summary.json
|
||||
coverage-path: twake/coverage/coverage-report.txt
|
||||
@@ -0,0 +1,26 @@
|
||||
name: docker-build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/docker/**"
|
||||
|
||||
jobs:
|
||||
build-nginx:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: cd twake && docker build -t twaketech/twake-nginx -f docker/twake-nginx/Dockerfile .
|
||||
|
||||
build-php:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: cd twake && docker build -t twaketech/twake-php -f docker/twake-php/Dockerfile .
|
||||
|
||||
build-node:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: cd twake && docker build --target production -t twaketech/twake-node -f docker/twake-node/Dockerfile .
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Use Node.js 16
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 16
|
||||
- run: npm install -g yarn
|
||||
- run: cd Documentation && yarn install --frozen-lockfile
|
||||
- name: Build
|
||||
run: cd Documentation && yarn docs:build
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: Documentation/docs/.vitepress/dist
|
||||
@@ -0,0 +1,23 @@
|
||||
name: integration-test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/**"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build
|
||||
run: cd twake && docker build -t integration-test -f docker/integration-test/Dockerfile .
|
||||
- name: build-node
|
||||
run: cd twake && docker build -t twaketech/twake-node -f docker/twake-node/Dockerfile .
|
||||
- name: run-twake-instance
|
||||
run: cd twake && docker-compose -f docker-compose.onpremise.mongo.yml up -d && sleep 60
|
||||
- name: get-logs
|
||||
run: cd twake && docker-compose -f docker-compose.onpremise.mongo.yml logs && curl http://localhost:3000
|
||||
- name: run integration-test
|
||||
run: cd twake && docker run --network host -e SERVER=http://localhost:3000 integration-test
|
||||
@@ -0,0 +1,131 @@
|
||||
name: labels
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- labeled
|
||||
- closed
|
||||
branches:
|
||||
- develop
|
||||
- refs/heads/develop
|
||||
|
||||
jobs:
|
||||
debug:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: log-all
|
||||
run: |
|
||||
echo ref: ${{github.ref}}
|
||||
echo merged: ${{github.event.pull_request.merged == true}} ${{github.event.pull_request.merged}}
|
||||
echo action: ${{github.event.action}}
|
||||
echo label: ${{github.event.label.name}}
|
||||
echo action-is-closed: ${{github.event.action == 'closed'}}
|
||||
echo set-staging-develop: ${{github.ref == 'refs/heads/develop' && github.event.action == 'closed' && github.event.pull_request.merged == true}}
|
||||
echo request-qa: ${{github.event.label.name == 'qa:ready' && github.event.pull_request.merged == true}}
|
||||
echo is backend label: ${{github.event.label.name == 'backend'}}
|
||||
|
||||
set-staging-develop:
|
||||
if: github.event.action == 'closed' && github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-ecosystem/action-add-labels@v1
|
||||
with:
|
||||
labels: "staging:develop"
|
||||
|
||||
request-qa:
|
||||
if: github.event.label.name == 'qa:ready' && github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: qa
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.WORKFLOW_GIT_TOKEN }}
|
||||
- name: cherry-picking
|
||||
run: |
|
||||
git config user.name "Labels Bot"
|
||||
git config user.email "labels-bot@github.com"
|
||||
git status
|
||||
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
||||
git push
|
||||
- uses: actions-ecosystem/action-add-labels@v1
|
||||
with:
|
||||
labels: "staging:qa"
|
||||
- uses: actions-ecosystem/action-remove-labels@v1
|
||||
with:
|
||||
labels: |
|
||||
qa:ready
|
||||
staging:develop
|
||||
|
||||
request-canary:
|
||||
if: github.event.label.name == 'canary:ready' && github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: canary
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.WORKFLOW_GIT_TOKEN }}
|
||||
- name: cherry-picking
|
||||
run: |
|
||||
git config user.name "Labels Bot"
|
||||
git config user.email "labels-bot@github.com"
|
||||
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
||||
git push
|
||||
- uses: actions-ecosystem/action-add-labels@v1
|
||||
with:
|
||||
labels: "staging:canary"
|
||||
- uses: actions-ecosystem/action-remove-labels@v1
|
||||
with:
|
||||
labels: |
|
||||
canary:ready
|
||||
staging:qa
|
||||
|
||||
request-priority-1:
|
||||
if: github.event.label.name == 'priority:1' && github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: qa
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.WORKFLOW_GIT_TOKEN }}
|
||||
- name: cherry-picking
|
||||
run: |
|
||||
git config user.name "Labels Bot"
|
||||
git config user.email "labels-bot@github.com"
|
||||
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
||||
git push
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: canary
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.WORKFLOW_GIT_TOKEN }}
|
||||
- name: cherry-picking
|
||||
run: |
|
||||
git config user.name "Labels Bot"
|
||||
git config user.email "labels-bot@github.com"
|
||||
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
||||
git push
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.WORKFLOW_GIT_TOKEN }}
|
||||
- name: cherry-picking
|
||||
run: |
|
||||
git config user.name "Labels Bot"
|
||||
git config user.email "labels-bot@github.com"
|
||||
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
||||
git push
|
||||
- uses: actions-ecosystem/action-add-labels@v1
|
||||
with:
|
||||
labels: "staging:main"
|
||||
- uses: actions-ecosystem/action-remove-labels@v1
|
||||
with:
|
||||
labels: |
|
||||
staging:develop
|
||||
staging:qa
|
||||
staging:canary
|
||||
priority:1
|
||||
@@ -0,0 +1,67 @@
|
||||
name: update-saas-backend
|
||||
|
||||
# Deploy backend only if push on "main"
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/docker/**"
|
||||
- "twake/backend/**"
|
||||
- ".github/workflows/**"
|
||||
|
||||
jobs:
|
||||
deploy-php:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- run: 'echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/develop')
|
||||
run: 'echo "DOCKERTAG=develop" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/qa')
|
||||
run: 'echo "DOCKERTAG=qa" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/canary')
|
||||
run: 'echo "DOCKERTAG=canary" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=${{ env.DOCKERTAGVERSION }}-canary" >> $GITHUB_ENV'
|
||||
- name: Set env to production
|
||||
if: endsWith(github.ref, '/main')
|
||||
run: 'echo "DOCKERTAG=latest" >> $GITHUB_ENV'
|
||||
- uses: actions/checkout@v2
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: twaketech/twake-php
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
workdir: twake
|
||||
buildoptions: "-t twaketech/twake-php -f docker/twake-php/Dockerfile"
|
||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
||||
|
||||
deploy-node:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- run: 'echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/develop')
|
||||
run: 'echo "DOCKERTAG=develop" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/qa')
|
||||
run: 'echo "DOCKERTAG=qa" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/canary')
|
||||
run: 'echo "DOCKERTAG=canary" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=${{ env.DOCKERTAGVERSION }}-canary" >> $GITHUB_ENV'
|
||||
- name: Set env to production
|
||||
if: endsWith(github.ref, '/main')
|
||||
run: 'echo "DOCKERTAG=latest" >> $GITHUB_ENV'
|
||||
- uses: actions/checkout@v2
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: twaketech/twake-node
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
workdir: twake
|
||||
context: .
|
||||
target: production
|
||||
buildoptions: "-t twaketech/twake-node -f docker/twake-node/Dockerfile"
|
||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
||||
@@ -0,0 +1,73 @@
|
||||
name: update-saas-frontend
|
||||
|
||||
# Edit with caution ! Made for build+test on "feature/*" push and pull requests events
|
||||
# And for only deploying on pushes on "main" branch
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/frontend/**"
|
||||
- "twake/docker/**"
|
||||
- ".github/workflows/**"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/frontend/**"
|
||||
|
||||
jobs:
|
||||
build-frontend:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
FRONTEND_ENV: ${{secrets.FRONTEND_ENV}}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm install -g yarn
|
||||
- run: cd twake/frontend/ && yarn install
|
||||
- run: cp twake/frontend/src/app/environment/environment.ts.dist twake/frontend/src/app/environment/environment.ts
|
||||
- if: ${{env.FRONTEND_ENV}}
|
||||
run: echo ${{ secrets.FRONTEND_ENV }} > twake/frontend/src/app/environment/environment.ts
|
||||
- run: cd twake/frontend/ && yarn test
|
||||
- run: cd twake/frontend/ && yarn build
|
||||
- name: Upload frontend build artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: frontend-build
|
||||
path: twake/frontend/build/
|
||||
|
||||
deploy-nginx:
|
||||
needs: build-frontend
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/qa' || github.ref == 'refs/heads/canary'
|
||||
steps:
|
||||
- run: 'echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/develop')
|
||||
run: 'echo "DOCKERTAG=develop" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/qa')
|
||||
run: 'echo "DOCKERTAG=qa" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
|
||||
- name: Set env to develop
|
||||
if: endsWith(github.ref, '/canary')
|
||||
run: 'echo "DOCKERTAG=canary" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=${{ env.DOCKERTAGVERSION }}-canary" >> $GITHUB_ENV'
|
||||
- name: Set env to production
|
||||
if: endsWith(github.ref, '/main')
|
||||
run: 'echo "DOCKERTAG=latest" >> $GITHUB_ENV'
|
||||
- uses: actions/checkout@v2
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: twaketech/twake-nginx
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
workdir: twake
|
||||
buildoptions: "-t twaketech/twake-nginx -f docker/twake-nginx/Dockerfile"
|
||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
||||
Reference in New Issue
Block a user