-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add github flows for integrating with origin-deployment (#2)
* add github flows for integrating with origin-deployment * Add dockerfile, add tests in pipeline --------- Co-authored-by: s-a-tanjim <[email protected]>
- Loading branch information
1 parent
97427c7
commit f0779f5
Showing
10 changed files
with
295 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Git | ||
.git | ||
.gitignore | ||
|
||
# CI | ||
.codeclimate.yml | ||
.travis.yml | ||
.taskcluster.yml | ||
|
||
# Docker | ||
compose.yml | ||
.docker | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*/__pycache__/ | ||
*/*/__pycache__/ | ||
*/*/*/__pycache__/ | ||
*.py[cod] | ||
*/*.py[cod] | ||
*/*/*.py[cod] | ||
*/*/*/*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Virtual environment | ||
.env/ | ||
.venv/ | ||
venv/ | ||
|
||
# PyCharm | ||
.idea | ||
|
||
# Python mode for VIM | ||
.ropeproject | ||
*/.ropeproject | ||
*/*/.ropeproject | ||
*/*/*/.ropeproject | ||
|
||
# Vim swap files | ||
*.swp | ||
*/*.swp | ||
*/*/*.swp | ||
*/*/*/*.swp |
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,24 @@ | ||
name: "-" | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: ${{ github.job.name }} | ||
runs-on: ${{ vars.RUNNER_TYPE }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build image | ||
run: | | ||
docker build --file Dockerfile -t ${{ github.sha }} . | ||
docker save -o /tmp/${{ github.sha }}.tar ${{ github.sha }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ github.sha }} | ||
path: /tmp/${{ github.sha }}.tar | ||
retention-days: 1 |
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,76 @@ | ||
name: Publish & Deploy | ||
run-name: "${{ inputs.AWS_ENV || 'DEV' }}: ${{ github.event.pull_request.title || github.ref }} ${{ inputs.UUID }}" | ||
|
||
on: | ||
pull_request: | ||
types: [ closed ] | ||
branches: [ dev ] | ||
|
||
workflow_dispatch: | ||
inputs: | ||
AWS_ENV: | ||
required: true | ||
default: DEV | ||
type: choice | ||
description: Environment to Deploy | ||
options: [ DEV, STAGE, PROD ] | ||
UUID: | ||
required: false | ||
type: string | ||
description: UUID of workflow | ||
|
||
env: | ||
SVC_NAME: "cesr_verifier" | ||
|
||
jobs: | ||
setup: | ||
if: | | ||
(contains(github.event.pull_request.title, '[no-deploy]') == false && github.event.pull_request.merged == true) || | ||
inputs.UUID || | ||
github.event_name == 'workflow_dispatch' | ||
runs-on: ${{ vars.RUNNER_TYPE }} | ||
steps: | ||
- run: echo "Dummy" | ||
outputs: | ||
AWS_ENV: ${{ inputs.AWS_ENV || 'DEV' }} | ||
SVC_NAME: ${{ env.SVC_NAME }} | ||
|
||
build: | ||
needs: setup | ||
uses: ./.github/workflows/build.yml | ||
secrets: inherit | ||
|
||
tag-push: | ||
name: ${{ needs.setup.outputs.AWS_ENV }} | ||
needs: [ setup, build ] | ||
uses: provenant-dev/github-action-helper/.github/workflows/tag-push.yml@main | ||
secrets: inherit | ||
with: | ||
AWS_ENV: ${{ needs.setup.outputs.AWS_ENV }} | ||
|
||
set-version: | ||
name: ${{ needs.setup.outputs.AWS_ENV }} | ||
needs: [ setup, tag-push ] | ||
uses: provenant-dev/github-action-helper/.github/workflows/set-version.yml@main | ||
secrets: inherit | ||
with: | ||
DEPLOY_ENV: ${{ needs.setup.outputs.AWS_ENV }} | ||
RELEASE_VERSION: ${{ needs.tag-push.outputs.RELEASE_VERSION }} | ||
SVC_NAME: ${{ needs.setup.outputs.SVC_NAME }} | ||
|
||
publish: | ||
name: ${{ needs.setup.outputs.AWS_ENV }} | ||
needs: [ setup, tag-push ] | ||
uses: provenant-dev/github-action-helper/.github/workflows/publish.yml@main | ||
secrets: inherit | ||
with: | ||
AWS_ENV: ${{ needs.setup.outputs.AWS_ENV }} | ||
RELEASE_VERSION: ${{ needs.tag-push.outputs.RELEASE_VERSION }} | ||
|
||
deploy: | ||
name: ${{ needs.setup.outputs.AWS_ENV }} | ||
needs: [ setup, publish, set-version ] | ||
uses: provenant-dev/github-action-helper/.github/workflows/deploy-helm.yml@main | ||
secrets: inherit | ||
with: | ||
AWS_ENV: ${{ needs.setup.outputs.AWS_ENV }} |
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,30 @@ | ||
name: Build, Tests & Push | ||
run-name: "${{ github.event.pull_request.title || github.ref }} ${{ inputs.UUID }}" | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, synchronize ] | ||
branches: [ dev ] | ||
workflow_dispatch: | ||
inputs: | ||
UUID: | ||
required: false | ||
type: string | ||
description: "UUID of workflow" | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
secrets: inherit | ||
|
||
tests: | ||
uses: ./.github/workflows/tests.yml | ||
secrets: inherit | ||
|
||
push: | ||
needs: build | ||
if: ${{ github.event_name != 'pull_request' && !inputs.UUID }} | ||
uses: provenant-dev/github-action-helper/.github/workflows/tag-push.yml@main | ||
secrets: inherit | ||
with: | ||
AWS_ENV: 'DEV' |
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,25 @@ | ||
name: Run tests | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
runs-on: ${{ vars.RUNNER_TYPE }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.branch_name }} | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
pip install pytest | ||
- name: Run tests | ||
run: pytest tests/ |
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,29 @@ | ||
FROM public.ecr.aws/docker/library/python:3.12-alpine3.20 AS base-image | ||
|
||
FROM base-image AS builder | ||
RUN apk add git patch gcc linux-headers musl-dev rustup libsodium-dev | ||
RUN rustup-init -y && source $HOME/.cargo/env | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
RUN python -m pip install --upgrade pip | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
FROM base-image | ||
|
||
RUN apk add --no-cache bash patch libsodium-dev jq linux-headers | ||
|
||
COPY --from=builder /usr /usr | ||
|
||
RUN addgroup --system --gid 1001 origin \ | ||
&& adduser --system --uid 1001 --disabled-password --shell /bin/false -G origin origin | ||
|
||
WORKDIR /app | ||
COPY --from=builder --chown=origin:origin /app /app | ||
USER origin | ||
|
||
ENTRYPOINT [ "verifier" ] | ||
CMD [ "server", "start", "--config-dir", "scripts", "--config-file", "verifier-config.json", "--http", "10100" ] |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
services: | ||
cesr-verifier: | ||
image: provenant/cesr-verifier:dev | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- 10100:10100 |
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