Skip to content

Commit

Permalink
Merge remote-tracking branch 'ccf-ui/hra-ui-migration' into ccf-ui-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
axdanbol committed Feb 6, 2024
2 parents a467808 + 964471f commit 7d39925
Show file tree
Hide file tree
Showing 1,082 changed files with 221,484 additions and 2,387 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true

[*]
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
updates:
- package-ecosystem: npm
schedule:
timezone: America/Indiana/Indianapolis
interval: monthly
directory: /
target-branch: develop
commit-message:
prefix: npm

- package-ecosystem: docker
schedule:
timezone: America/Indiana/Indianapolis
interval: monthly
directory: /
target-branch: develop
commit-message:
prefix: docker

- package-ecosystem: github-actions
schedule:
timezone: America/Indiana/Indianapolis
interval: monthly
directory: /
target-branch: develop
commit-message:
prefix: github-actions
37 changes: 37 additions & 0 deletions .github/deploy-comment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Create Deploy Comment
description: Creates and Updates the deploy Comment
inputs:
deploy-url:
description: Url for deployed preview
required: true
runs:
using: composite
steps:
- name: Find Comment
uses: peter-evans/find-comment@v2
id: 'fc'
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '# :rocket: Preview Deploy Report'

- name: Create Comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# :rocket: Preview Deploy Report
✅ Successfully deployed preview [here](${{ inputs.deploy-url }})
- name: Update Comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{steps.fc.outputs.comment-id}}
edit-mode: replace
body: |
# :rocket: Preview Deploy Report Updated
✅ Successfully deployed preview [here](${{ inputs.deploy-url }})
60 changes: 60 additions & 0 deletions .github/workflows/beta-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 'Beta Build'

on:
push:
branches: ['ccf-v1.x']

jobs:
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v2
with:
ref: ccf-v1.x
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Use Java 11
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run build:libs
- name: Build EUI
run: |
npm run build ccf-eui -- --output-hashing=none --base-href=/ --configuration=staging
npm run build:ccf-eui:wc
- name: Build RUI
run: |
npm run build ccf-rui -- --project ccf-rui --output-hashing=none --base-href=/rui/ --configuration=staging
npm run build:ccf-rui:wc
cp -r dist/ccf-rui dist/ccf-ui/rui
- name: Build Organ Info
run: |
npm run build ccf-organ-info -- --project ccf-organ-info --output-hashing=none --base-href=/organ-info/ --configuration=staging
npm run build:ccf-organ-info:wc
cp -r dist/ccf-organ-info dist/ccf-ui/organ-info
- run: |
npm run compodoc
mkdir -p dist/ccf-ui
cp -r docs dist/ccf-ui
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist/ccf-ui
publish_branch: beta
commit_message: "Beta deploy -- ${{ github.event.head_commit.message }}"
141 changes: 141 additions & 0 deletions .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: 'Combine PRs'

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
inputs:
branchPrefix:
description: 'Branch prefix to find combinable PRs based on'
required: true
default: 'dependabot'
mustBeGreen:
description: 'Only combine PRs that are green (status is success)'
required: true
default: 'false'
combineBranchName:
description: 'Name of the branch to combine PRs into'
required: true
default: 'combine-prs-branch'
ignoreLabel:
description: 'Exclude PRs with this label'
required: true
default: 'nocombine'

# 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 "combine-prs"
combine-prs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/github-script@v6
id: fetch-branch-names
name: Fetch branch names
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', {
owner: context.repo.owner,
repo: context.repo.repo
});
branches = [];
prs = [];
base_branch = null;
for (const pull of pulls) {
const branch = pull['head']['ref'];
console.log('Pull for branch: ' + branch);
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) {
console.log('Branch matched: ' + branch);
statusOK = true;
if(${{ github.event.inputs.mustBeGreen }}) {
console.log('Checking green status: ' + branch);
const statuses = await github.paginate('GET /repos/{owner}/{repo}/commits/{ref}/status', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: branch
});
if(statuses.length > 0) {
const latest_status = statuses[0]['state'];
console.log('Validating status: ' + latest_status);
if(latest_status != 'success') {
console.log('Discarding ' + branch + ' with status ' + latest_status);
statusOK = false;
}
}
}
console.log('Checking labels: ' + branch);
const labels = pull['labels'];
for(const label of labels) {
const labelName = label['name'];
console.log('Checking label: ' + labelName);
if(labelName == '${{ github.event.inputs.ignoreLabel }}') {
console.log('Discarding ' + branch + ' with label ' + labelName);
statusOK = false;
}
}
if (statusOK) {
console.log('Adding branch to array: ' + branch);
branches.push(branch);
prs.push('#' + pull['number'] + ' ' + pull['title']);
base_branch = pull['base']['ref'];
}
}
}
if (branches.length == 0) {
core.setFailed('No PRs/branches matched criteria');
return;
}
core.setOutput('base-branch', base_branch);
core.setOutput('prs-string', prs.join('\n'));
combined = branches.join(' ')
console.log('Combined: ' + combined);
return combined
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
with:
fetch-depth: 0
# Creates a branch with other PR branches merged together
- name: Created combined branch
env:
BASE_BRANCH: ${{ steps.fetch-branch-names.outputs.base-branch }}
BRANCHES_TO_COMBINE: ${{ steps.fetch-branch-names.outputs.result }}
COMBINE_BRANCH_NAME: ${{ github.event.inputs.combineBranchName }}
run: |
echo "$BRANCHES_TO_COMBINE"
sourcebranches="${BRANCHES_TO_COMBINE%\"}"
sourcebranches="${sourcebranches#\"}"
basebranch="${BASE_BRANCH%\"}"
basebranch="${basebranch#\"}"
git config pull.rebase false
git config user.name github-actions
git config user.email [email protected]
git branch $COMBINE_BRANCH_NAME $basebranch
git checkout $COMBINE_BRANCH_NAME
git pull origin $sourcebranches --no-edit
git push origin $COMBINE_BRANCH_NAME
# Creates a PR with the new combined branch
- uses: actions/github-script@v6
name: Create Combined Pull Request
env:
PRS_STRING: ${{ steps.fetch-branch-names.outputs.prs-string }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const prString = process.env.PRS_STRING;
const body = 'This PR was created by the Combine PRs action by combining the following PRs:\n' + prString;
await github.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Combined PR',
head: '${{ github.event.inputs.combineBranchName }}',
base: '${{ steps.fetch-branch-names.outputs.base-branch }}',
body: body
});
42 changes: 42 additions & 0 deletions .github/workflows/production-api-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Production API Build'

on:
workflow_run:
workflows: ['Tests']
branches: ['main']
types:
- completed

jobs:
deploy:
name: 'Deploy'
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: main

- name: Setup environment
run: cp .env.example .env

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ccf-api
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
42 changes: 42 additions & 0 deletions .github/workflows/staging-api-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Staging API Build'

on:
workflow_run:
workflows: ['Tests']
branches: ['develop']
types:
- completed

jobs:
deploy:
name: 'Deploy'
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: develop

- name: Setup environment
run: cp .env.example .env

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ccf-api
IMAGE_TAG: staging
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
Loading

0 comments on commit 7d39925

Please sign in to comment.