Skip to content

Commit

Permalink
Merge branch 'main' into rm-balsamic-qc
Browse files Browse the repository at this point in the history
# Conflicts:
#	cg_hermes/config/balsamic_qc.py
  • Loading branch information
henrikstranneheim committed Nov 26, 2024
2 parents 163bd27 + 6cf8cb4 commit 0fae367
Show file tree
Hide file tree
Showing 17 changed files with 4,180 additions and 2,165 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 5.1.0
current_version = 5.1.2
commit = True
tag = True
tag_name = {new_version}
Expand Down
45 changes: 29 additions & 16 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
## Description
*This PR adds/fixes ...*

### Added

-

### Changed

-

### Fixed

-

## Testing

### How to prepare for test
- [ ] ssh to hasta.scilifelab.se
- [ ] Use stage: `us`
- [ ] Paxa the environment: `paxa`
- [ ] Install on stage (example for hasta):
`bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_hermes -t hermes -b [THIS-BRANCH-NAME]`

- [ ] ssh to Hasta
- [ ] Test your branch with

```bash
hermes-test-deploy <branch-name>
hermes-test <command here>
```

### How to test
- [ ] Do ...
- [ ] login to ...
- [ ] do ...

### Expected test outcome
- [ ] Check that ...
### Expected test result
- [ ] check that ...
- [ ] Take a screenshot and attach or copy/paste the output.

## Review
- [ ] Tests executed by
- [ ] code approved by
- [ ] tests executed by
- [ ] "Merge and deploy" approved by
Thanks for filling in who performed the code review and the test!

### This [version](https://semver.org/) is a
This [version](https://semver.org/) is a:
- [ ] **MAJOR** - when you make incompatible API changes
- [ ] **MINOR** - when you add functionality in a backwards compatible manner
- [ ] **PATCH** - when you make backwards compatible bug fixes or documentation/instructions

## Implementation Plan
- [ ] Document in ...
- [ ] Deploy this branch
- [ ] Inform to ...
30 changes: 30 additions & 0 deletions .github/workflows/build_dockerfile_on_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and publish docker image on push

on: [push]

jobs:
docker-image-push:
runs-on: ubuntu-latest
steps:
- name: Check out git repository
uses: actions/checkout@v4

- name: Extract branch name and remove illegal chars
id: get_branch_name
shell: bash
run: echo "##[set-output name=branch;]$(echo "$(tr "/" "-" <<<${GITHUB_REF#refs/heads/})")"

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build image
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
push: true
tags: "clinicalgenomics/hermes:${{steps.get_branch_name.outputs.branch}}, clinicalgenomics/hermes:latest"

29 changes: 29 additions & 0 deletions .github/workflows/build_dockerfile_on_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and publish image on new release event

on:
release:
types:
- created

jobs:
docker-image-release_push:
# Push to Docker Hub when a new release is created
runs-on: ubuntu-latest
steps:

- name: Check Out Repo
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build image
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
push: true
tags: "clinicalgenomics/hermes:${{github.event.release.tag_name}}, clinicalgenomics/hermes:latest"
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
args: ["--line-length", "100"]
Expand All @@ -10,7 +10,7 @@ repos:
- id: isort
name: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.8.0
hooks:
- id: ruff

63 changes: 16 additions & 47 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,21 @@
# Steps
# Deployment guide
This includes instructions for deploying Hermes in the Clinical Genomics :hospital: setting.

When all tests done and successful and PR is approved by codeowners, follow these steps:
## Steps
When all tests are done and successful and the PR is approved by codeowners, follow these steps:

1. Select "Squash and merge" to merge branch into default branch (master/main).


2. A prompt for writing merge commit message will pop up.


3. Find the title of the pull request already pre-filled in the merge commit title, or copy and paste
the title if not.


4. Append version increment value `( major | minor | patch )` to specify what kind of release is to be created.


5. Fill in markdown formatted changelog in merge commit comment details:

` ### Added `
### Deploy feature branch for testing
To deploy your feature branch to test it, run
1. `hermes-test-deploy <branch_name>`
2. `hermes-test --help` or the command you want to test.

` ### Changed `
This will pull the latest image tagged with your branch from Dockerhub and make it available with `hermes-test`. Note that it is not necessary to paxa the environment to do this.

` ### Fixed `

6. Review the details once again and merge the branch into master.


7. Wait for GitHub actions to process the event, bump version, create release, publish to Dockerhub and PyPi.


8. Deploy master to stage:
1. Log in to appropriate server `ssh <server.scilifelab.se>`
2. `us`
3. Request stage environment `paxa` and follow instructions
4. ```shell
bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_hermes -t hermes -b main
```
5. Make sure that installation was successful


9. Deploy master to production
1. Log in to appropriate server `ssh <server.scilifelab.se>`
2. `up`
3. ```shell
bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-prod.sh -e P_hermes -t hermes -b main
```
4. Make sure that installation was successful


11. Take a screenshot or copy log text and post as a comment on the PR. Screenshot should include environment and that it succeeded.

### Deploy to stage and production
1. Select "Squash and merge" to merge branch into default branch (master/main).
2. Append version increment value `( major | minor | patch )` in the commit message to specify what kind of release is to be created.
3. Review the details and merge the branch into master.
4. Deploy the latest version to stage and production with `hermes-deploy`.
5. Take a screenshot or copy log text and post as a comment on the PR. Screenshot should include environment and that it succeeded.
6. Great job :whale2:
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM docker.io/library/python:3.12-slim-bullseye

WORKDIR /app
COPY . /app/

RUN pip install --no-cache-dir --ignore-installed poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-cache --only main

ENTRYPOINT ["hermes"]
Loading

0 comments on commit 0fae367

Please sign in to comment.