Skip to content

Commit

Permalink
Merge pull request #162 from UserOfficeProject/release_26-01-23
Browse files Browse the repository at this point in the history
Release 26 01 23
  • Loading branch information
mutambaraf authored Jan 26, 2023
2 parents a0094e9 + df41bd9 commit 5e1ae7f
Show file tree
Hide file tree
Showing 165 changed files with 9,526 additions and 9,896 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Specify a different separator for branch names

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
pull-request-branch-name:
# Separate sections of the branch name with a hyphen because docker hub doesn't want slashes
# for example, `dependabot-npm_and_yarn-next_js-acorn-6.4.1`
separator: "-"
68 changes: 25 additions & 43 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
name: Build && Push

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the develop branch
# Controls when the action will run
on:
push:
branches: [develop]
branches:
- develop
- staging

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
# List of jobs
build:
# The type of runner that the job will run on
# The type of virtual machine that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3

- name: Extract branch name
id: extract_branch
shell: bash
run: |
# Extract branch name
BRANCH_NAME=${GITHUB_REF#refs/heads/}
# set output variable accessible in the action
echo ::set-output name=branch::${BRANCH_NAME}
# For debugging capture the selected branch
- name: Extracted branch
run: echo "Extracted branch ${{ steps.extract_branch.outputs.branch }}"
- id: extract_branch
uses: swapActions/get-branch-name@v1

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -57,10 +44,10 @@ jobs:

- name: Install Node.js dependencies
run: npm ci

- name: Set environment variables
run: cp apps/user-office-frontend/example.development.env apps/user-office-frontend/.env

- name: Set environment variables
run: cp apps/user-office-frontend/example.development.env apps/user-office-frontend/.env

- name: Generate SDK
run: npm run generate:sdk

Expand Down Expand Up @@ -89,24 +76,19 @@ jobs:
ghcr.io/userofficeproject/user-office-frontend:${{ steps.extract_branch.outputs.branch }}
- name: Trigger pipeline
run: |
REPOSITORY=${{ github.repository }}
RESULT=$(curl -X POST \
-F token="${{ secrets.GITLAB_TRIGGER_TOKEN }}" \
-F ref=master \
-F "variables[RUN_DEPLOY]=1" \
-F "variables[BRANCH]=${{ steps.extract_branch.outputs.branch }}" \
-F "variables[REPOSITORY]=${REPOSITORY#UserOfficeProject/}" \
-o /dev/null \
--silent \
--write-out '%{http_code}' \
${{ secrets.GITLAB_TRIGGER_URL }})
if [[ $RESULT != "201" ]]; then
echo "Failed to trigger Gitlab pipeline: $RESULT"
exit 1
fi
uses: swapActions/trigger-useroffice-deployment@v1
with:
repository: ${{ github.repository }}
environment: ${{ steps.extract_branch.outputs.branch }}
gh-trigger-url: ${{ secrets.GITLAB_TRIGGER_URL }}
gh-token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}

- name: Trigger Jenkins
- name: Trigger frontend deployment at STFC
if: ${{ steps.extract_branch.outputs.branch == 'develop' }} # Only trigger Jenkins for develop branch
run: |
curl -k -l -u ${{ secrets.STFC_CI_TRIGGER_USERNAME }}:${{ secrets.STFC_CI_TRIGGER_TOKEN }} "${{ secrets.STFC_CI_TRIGGER_BASE_URL }}/Dev_Deploy_ProposalFrontend.LatestImage/build?token=${{ secrets.STFC_CI_TRIGGER_URL_TOKEN }}"
- name: Trigger backend deployment at STFC
if: ${{ steps.extract_branch.outputs.branch == 'develop' }} # Only trigger Jenkins for develop branch
run: |
curl -k -l -u ${{ secrets.STFC_CI_TRIGGER_USERNAME }}:${{ secrets.STFC_CI_TRIGGER_TOKEN }} "${{ secrets.STFC_CI_TRIGGER_BASE_URL }}/Dev_Deploy_ProposalBackend.LatestImage/build?token=${{ secrets.STFC_CI_TRIGGER_URL_TOKEN }}"
25 changes: 16 additions & 9 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
FACTORY_TAG="${{ github.head_ref }}"
fi
echo ::set-output name=FACTORY_TAG::${FACTORY_TAG}
echo "FACTORY_TAG=${FACTORY_TAG}" >> $GITHUB_OUTPUT
- name: Resolved
run: |
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
- name: Install frontend dependencies
if: steps.cached-node-modules-frontend.outputs.cache-hit != 'true'
run: npm run install:frontend

- name: Cache frontend SDK
id: cached-sdk-frontend
uses: actions/cache@v3
Expand Down Expand Up @@ -151,14 +151,16 @@ jobs:
with:
path: apps/user-office-frontend/node_modules
key: node-modules-frontend-${{ hashFiles('apps/user-office-frontend/package-lock.json') }}

- name: Restore frontend SDK
id: cached-sdk-frontend
uses: actions/cache@v3
with:
path: apps/user-office-frontend/src/generated
key: sdk-frontend-${{ hashFiles('**/**.graphql') }}

restore-keys: |
sdk-frontend-${{ hashFiles('**/**.graphql') }}
sdk-frontend-
- run: npm run build
env:
Expand Down Expand Up @@ -251,14 +253,16 @@ jobs:
with:
path: apps/user-office-frontend/node_modules
key: node-modules-frontend-${{ hashFiles('apps/user-office-frontend/package-lock.json') }}

- name: Restore frontend SDK
id: cached-sdk-frontend
uses: actions/cache@v3
with:
path: apps/user-office-frontend/src/generated
key: sdk-frontend-${{ hashFiles('**/**.graphql') }}

restore-keys: |
sdk-frontend-${{ hashFiles('**/**.graphql') }}
sdk-frontend-
# TODO: See how to proceed with e2e caching because there is some error:
# - You're caching 'node_modules' but are not caching this path: /home/runner/.cache/Cypress
Expand Down Expand Up @@ -375,7 +379,7 @@ jobs:
push:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: e2e
needs: [install-and-cache, e2e]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# TODO: Maybe it is a good idea to use some caching mechanism here for building docker images.
Expand Down Expand Up @@ -415,14 +419,17 @@ jobs:
tags: |
dmsc/duo-backend:${{ github.head_ref }}
ghcr.io/userofficeproject/user-office-backend:${{ github.head_ref }}
- name: Restore frontend SDK
id: cached-sdk-frontend
uses: actions/cache@v3
with:
path: apps/user-office-frontend/src/generated
key: sdk-frontend-${{ hashFiles('**/**.graphql') }}

restore-keys: |
sdk-frontend-${{ hashFiles('**/**.graphql') }}
sdk-frontend-
- name: Build and push frontend
uses: docker/build-push-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
apps/user-office-frontend/node_modules
apps/user-office-frontend-e2e/node_modules
apps/user-office-frontend-e2e/cypress/screenshots
apps/user-office-backend/node_modules
apps/user-office-frontend/src/generated
Loading

0 comments on commit 5e1ae7f

Please sign in to comment.