Skip to content

Commit

Permalink
Merge pull request #70 from IDEA-Research/dev
Browse files Browse the repository at this point in the history
Merge to release
  • Loading branch information
shuyuew authored Jul 21, 2023
2 parents aba4bba + 270c058 commit b21cf8e
Show file tree
Hide file tree
Showing 66 changed files with 1,979 additions and 936 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/app-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: app-cd
on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*-dev*'
- 'v*.*.*-test*'
- 'v*.*.*-prd*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
env:
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/app-frontend-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: app-frontend-cd
on:
push:
tags:
- 'v*.*.*-app*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
build:
if: github.repository_owner == 'deepdataspace'
runs-on: self-hosted
outputs:
PORT: ${{ steps.check_env_vars.outputs.PORT }}
NAMESPACE: ${{ steps.check_env_vars.outputs.NAMESPACE }}
steps:
- name: Checkout deepdataspace
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get Git Tag
id: get_git_tag
run: echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT

- name: Set Environment Variables
run: |
# parse git tag
gitTag="${{ steps.get_git_tag.outputs.tag }}"
echo "GIT_TAG=${gitTag}" >> $GITHUB_ENV
# parse namespace
if [[ "${gitTag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-appdev[0-9]+ ]]; then
namespace=dev
port=7002
elif [[ "${gitTag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-apptest[0-9]+ ]]; then
namespace=test
port=7003
elif [[ "${gitTag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-app[0-9]+ ]]; then
namespace=prod
port=7004
else
echo "Invalid git tag. Pipeline terminated."
exit 1
fi
echo "NAMESPACE=${namespace}" >> $GITHUB_ENV
echo "PORT=${port}" >> $GITHUB_ENV
- name: Check Environment Variables
id: check_env_vars
run: |
echo env.PORT=${{ env.PORT }}
echo env.NAMESPACE=${{ env.NAMESPACE }}
echo "PORT=${{ env.PORT }}" >> $GITHUB_OUTPUT
echo "NAMESPACE=${{ env.NAMESPACE }}" >> $GITHUB_OUTPUT
- name: Checkout deepdataspace-app-env
uses: actions/checkout@v2
with:
repository: deepdataspace/deepdataspace-app-env
ref: 'main'
path: deepdataspace-app-env
token: ${{ secrets.DDS_ORG_GITHUB_TOKEN }}

- name: Copy Frontend Build Env File
run: |
NAMESPACE=${{ env.NAMESPACE }}
cp deepdataspace-app-env/app/.env.${NAMESPACE} packages/app/.env.local
echo "TAG_VERSION=${{ env.GIT_TAG }}" >> packages/app/.env.local
cp deepdataspace-app-env/app/Dockerfile packages/app
cp deepdataspace-app-env/app/nginx.conf packages/app
rm -rf deepdataspace-app-env
- name: Build Docker Image
run: |
NAMESPACE=${{ env.NAMESPACE }}
pnpm i --frozen-lockfile
cd packages/app
pnpm run build
docker image build -f ./Dockerfile -t dds-app-${NAMESPACE}-frontend:latest .
deploy:
if: github.repository_owner == 'deepdataspace'
runs-on: self-hosted
needs: build
steps:
- name: Stop Running Docker
run: |
PORT=${{ needs.build.outputs.PORT }}
CONTAINER_ID=`docker ps -a | grep ${PORT} | cut -d " " -f 1`
docker stop ${CONTAINER_ID}
docker rm ${CONTAINER_ID}
continue-on-error: true

- name: Run New Docker Image
run: |
PORT=${{ needs.build.outputs.PORT }}
NAMESPACE=${{ needs.build.outputs.NAMESPACE }}
sleep 1
docker run --restart=always -d -p ${PORT}:80 dds-app-${NAMESPACE}-frontend
28 changes: 14 additions & 14 deletions .github/workflows/tool-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ jobs:
run: |
pip install -r requirements-dev.txt
pytest --cov=deepdataspace -s --cov-report=xml
# - name: Upload Test Report
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# verbose: true
# flags: backend
- name: Upload Test Report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
flags: backend
test_frontend:
if: github.repository_owner == 'IDEA-Research'
runs-on: self-hosted
Expand All @@ -118,10 +118,10 @@ jobs:
run: pnpm run dev:build
- name: Run tests and collect coverage
run: pnpm run test
# - name: Upload Test Report
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# verbose: true
# flags: frontend
- name: Upload Test Report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
flags: frontend
Loading

0 comments on commit b21cf8e

Please sign in to comment.