Skip to content

Commit d0d30b7

Browse files
authored
Merge pull request #30 from NFDI4Chem/development
Development
2 parents c50884d + 7fe2060 commit d0d30b7

File tree

6 files changed

+159
-7
lines changed

6 files changed

+159
-7
lines changed

.github/workflows/dev-build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
# This worklflow will perform following actions when the code is pushed to development branch:
3+
# - Build the latest docker image in development which needs test to pass first.
4+
# - Push the docker image to Docker Hub under namespace - caffeinejena with tag:dev-latest.
5+
#
6+
# Maintainers:
7+
# - name: Nisha Sharma
8+
# - email: nisha.sharma@uni-jena.de
9+
10+
name : Dev Build, Test and Publish
11+
12+
on:
13+
push:
14+
branches: [development]
15+
16+
env:
17+
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_USERNAME }}
18+
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
19+
REPOSITORY_NAME: nmrkit
20+
REPOSITORY_NAMESPACE: caffeinejena
21+
22+
jobs:
23+
test:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
matrix:
27+
python-version: ["3.10"]
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v3
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install flake8 pytest
38+
- name: Analysing the code with pylint
39+
run: |
40+
flake8 --ignore E402,E501,W503 $(git ls-files '*.py')
41+
# - name: Run test
42+
# run: |
43+
# pytest -p no:warnings
44+
45+
push_to_registry:
46+
name: Push Docker image to Docker Hub
47+
runs-on: ubuntu-latest
48+
needs: test
49+
steps:
50+
- name: Check out the repo
51+
uses: actions/checkout@v3
52+
53+
- name: Log in to Docker Hub
54+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
55+
with:
56+
username: ${{ env.DOCKER_HUB_USERNAME }}
57+
password: ${{ env.DOCKER_HUB_PASSWORD }}
58+
59+
- name: Build and push Docker image
60+
uses: docker/build-push-action@v4
61+
with:
62+
context: .
63+
file: ./Dockerfile
64+
push: true
65+
build-args: |
66+
RELEASE_VERSION=dev-latest
67+
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest
68+
username: ${{ env.DOCKER_HUB_USERNAME }}
69+
password: ${{ env.DOCKER_HUB_PASSWORD }}

.github/workflows/prod-build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
# This worklflow will perform following actions when the code is pushed to main branch:
3+
# - Build the latest docker image in development which needs test to pass first.
4+
# - Push the docker image to Docker Hub under namespace - caffeinejena with tag:[release_version].
5+
#
6+
# Maintainers:
7+
# - name: Nisha Sharma
8+
# - email: nisha.sharma@uni-jena.de
9+
10+
name : Prod Build, Test and Publish
11+
12+
on:
13+
release:
14+
types: [published]
15+
16+
env:
17+
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_USERNAME }}
18+
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
19+
REPOSITORY_NAME: nmrkit
20+
REPOSITORY_NAMESPACE: caffeinejena
21+
22+
jobs:
23+
push_to_registry:
24+
name: Push Docker image to Docker Hub
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Check out the repo
28+
uses: actions/checkout@v3
29+
30+
#Fetch Latest release
31+
- name: Fetch latest release
32+
id: fetch-latest-release
33+
uses: InsonusK/get-latest-release@v1.0.1
34+
with:
35+
myToken: ${{ github.token }}
36+
exclude_types: "draft"
37+
view_top: 10
38+
- name: "Print release name"
39+
run: |
40+
echo "tag_name: ${{ steps.fetch-latest-release.outputs.tag_name }}"
41+
42+
#Login to Docker Hub
43+
- name: Log in to Docker Hub
44+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
45+
with:
46+
username: ${{ env.DOCKER_HUB_USERNAME }}
47+
password: ${{ env.DOCKER_HUB_PASSWORD }}
48+
49+
#Build and push Docker image
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@v4
52+
with:
53+
context: .
54+
file: ./Dockerfile
55+
push: true
56+
build-args: |
57+
RELEASE_VERSION=${{ steps.fetch-latest-release.outputs.tag_name }}
58+
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ steps.fetch-latest-release.outputs.tag_name }}
59+
username: ${{ env.DOCKER_HUB_USERNAME }}
60+
password: ${{ env.DOCKER_HUB_PASSWORD }}
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
11

22
# This worklflow will perform following actions when the code is pushed to main branch.
3-
# - Trigger release-please action to create release.
3+
# - Test linting with pylint.
4+
# - Test the code with pytest.
5+
# - Trigger release-please action to create release which needs test to pass first.
46
#
57
# Maintainers:
68
# - name: Nisha Sharma
79
# - email: nisha.sharma@uni-jena.de
810

9-
name: release-please
11+
name: release-please-action
1012

1113
on:
1214
push:
1315
branches:
1416
- main
1517

1618
jobs:
19+
test:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
python-version: ["3.10"]
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Analysing the code with pylint
31+
run: |
32+
flake8 --ignore E402,E501,W503 $(git ls-files '*.py')
33+
- name: Run test
34+
run: |
35+
python3 -m pytest -p no:warnings
36+
1737
release-please:
1838
runs-on: ubuntu-latest
39+
needs: test
1940
steps:
2041
- uses: google-github-actions/release-please-action@v3
2142
with:
2243
release-type: python
2344
package-name: release-please-action
24-
token: ${{ secrets.GITHUB_TOKEN }}
45+
token: ${{ secrets.PAT }}
2546
prerelease: true

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ WORKDIR /code
3232
COPY ./requirements.txt /code/requirements.txt
3333
COPY ./alembic.ini /code/alembic.ini
3434

35-
RUN pip3 install --upgrade setuptools pip
35+
RUN pip3 install --upgrade setuptools pip && \
36+
apt-get update && apt-get install -y git
37+
3638
RUN pip3 install --no-cache-dir -r /code/requirements.txt
3739

3840
RUN python3 -m pip uninstall -y uvicorn

docs/.vitepress/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ export default defineConfigWithTheme<ThemeConfig>({
99
base: '/nmrkit/',
1010
cleanUrls: false,
1111
srcDir: 'src',
12-
1312
themeConfig: {
1413
logo: {
1514
light: '/logo.svg',
1615
dark: '/logo-dark.svg',
1716
},
1817
nav: [
19-
{ text: 'Home', link: '/introduction' },
20-
{ text: 'API', link: '' },
18+
{ text: 'Home', link: '/nmrkit/introduction' },
19+
{ text: 'API', link: 'https://api.nmrxiv.org/latest/docs' },
20+
{ text: 'GitHub', link: 'https://github.com/NFDI4Chem/nmrkit' }
2121
],
2222
sidebar: [
2323
{

0 commit comments

Comments
 (0)