Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
refactor unidock tools cicd workflow (#25)
Browse files Browse the repository at this point in the history
* refactor:ut by module

* rm old ut

* refactor:use pytest syntex for ut

* fix:ut

* fix static type

* fix static type 2

* fix static type 3

* build:base env dockerfile

* feat:add application e2e tests

* fix:e2e tests

* fix:app test read score

* fix:app test

* build:update unidocktools ci

* test:update tools ci trigger condition

* build:fix tool yaml

* build:fix ci yaml variable

* build:fix build ninja dep

* build:fix ninja dep

* test: ut unidock input change to 1iep

* test: skip ad4 test

* build:change push image condition

* feat(unidock):add energy_range arg

* build:downgrade docker login action

* build:reupdate docker login action

* build:dockerhub token

* build:add checkout

* build:change docker login action version

* build:change docker login action version 2

* build:docker login action 3

* build:docker build job

* build image workflow trigger after push

* style:pyright check

* build:fix toml pyright setting

---------

Co-authored-by: Yuan Yannan <[email protected]>
  • Loading branch information
dp-yuanyn and YNYuan authored Feb 21, 2024
1 parent bf7e986 commit 70aa9c8
Show file tree
Hide file tree
Showing 40 changed files with 21,119 additions and 4,807 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/ci_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Uni-Dock/Tools Build Image Workflow
on:
push:
branches:
- main

jobs:
build_unidock_docker_image:
if: github.repository_owner == 'dptech-corp'
runs-on: ubuntu-latest
strategy:
matrix:
cuda-version: ["12.0.0"]
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: dptechnology
password: ${{ secrets.DOCKERHUB_PAT }}

- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7

- name: build and push container
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
tags: dptechnology/unidock:${{ steps.short-sha.outputs.sha }},dptechnology/unidock:latest
file: containers/Dockerfile.cuda${{ matrix.cuda-version }}
context: "{{defaultContext}}:unidock"
push: true

build_unidock_tools_docker_image:
if: github.repository_owner == 'dptech-corp'
runs-on: ubuntu-latest
strategy:
matrix:
cuda-version: ["12.0.0"]
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: dptechnology
password: ${{ secrets.DOCKERHUB_PAT }}

- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7

- name: build and push container
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
build-args: BASE_IMAGE=xmyyn/unidock_tools_base:0.0.1_cuda${{ matrix.cuda-version }}
tags: dptechnology/unidock_tools:${{ steps.short-sha.outputs.sha }},dptechnology/unidock_tools:latest
file: unidock_tools/containers/Dockerfile
push: true
99 changes: 99 additions & 0 deletions .github/workflows/ci_test_tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Uni-Dock Tools CI/CD
on:
push:
branches:
- '**ci**'
pull_request:
branches:
- main

env:
PYTHON_VERSION: "3.11"

jobs:
flake8:
continue-on-error: true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Run flake8 formating
run: |
flake8 unidock_tools/unidock_tools --exit-zero
pyright:
continue-on-error: true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyright
- name: Run pyright check
id: pyright_check
working-directory: ./unidock_tools
run: |
pyright
tests:
if: ${{ always() }}
needs: [flake8,pyright]
runs-on: nvidia
strategy:
matrix:
cuda-version: ["12.0.0"]
container:
image: docker.io/xmyyn/unidock_tools_base:0.0.1_cuda${{ matrix.cuda-version }}
options: --gpus all
steps:
- name: checkout repo
uses: actions/checkout@v4

- name: install unidock
working-directory: ./unidock
run: |
apt-get update && apt-get install -y ninja-build
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build .
cmake --install .
cd ..
- name: check env
run: |
unidock --version
confgen --version
which python
- name: install tools
working-directory: ./unidock_tools
run: |
pip install .
- name: run unit-test
run: |
pip install pytest pytest-cov
pytest unidock_tools/tests/ut -vv --cov --cov-report term
- name: run application e2e test
run: |
pytest unidock_tools/tests/applications -vv --cov --cov-report term
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Uni-Dock CI/CD
on:
push:
branches: []
branches:
- '**ci**'
pull_request:
branches: [ main ]
branches:
- main

jobs:
unidock_test:
Expand Down Expand Up @@ -52,35 +54,3 @@ jobs:
python -m pip install --upgrade pip
pip install pytest>=8.0.0 pytest-cov
pytest unidock/test/ut -vv --doctest-modules --junitxml=junit/test-results.xml --cov --cov-report term
build_docker_image:
needs: unidock_test
runs-on: ubuntu-latest
steps:

- name: log in to docker hub
uses: docker/login-action@v3
if: github.event_name == 'push'
with:
username: dptechnology
password: ${{ secrets.DOCKERHUB_PAT }}

- name: set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v2

- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7

- name: check commit short sha
run: echo ${{ steps.short-sha.outputs.sha }}

- name: build and push container
uses: docker/build-push-action@v4
with:
tags: dptechnology/unidock:${{ steps.short-sha.outputs.sha }},dptechnology/unidock:latest
file: Dockerfile
context: "{{defaultContext}}:unidock"
push: ${{ github.event_name == 'push' }}
113 changes: 0 additions & 113 deletions .github/workflows/ci_tools.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Running this Docker image requires Docker to support NVIDIA GPUs. Please make sure NVIDIA Container Toolkit is configured.
# See https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html https://github.com/NVIDIA/nvidia-docker

FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
FROM nvidia/cuda:12.0.0-devel-ubuntu22.04

COPY . /opt/unidock

Expand Down
30 changes: 0 additions & 30 deletions unidock_tools/Dockerfile

This file was deleted.

16 changes: 16 additions & 0 deletions unidock_tools/containers/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG BASE_IMAGE

FROM ${BASE_IMAGE}

COPY ./unidock /opt/unidock

RUN cd /opt/unidock && \
cmake -B build && \
cmake --build build -j`nprocs` && \
cmake --install build && \
rm -r /opt/unidock

COPY ./unidock_tools /opt/unidock_tools
RUN cd /opt/unidock_tools && \
pip install . && \
rm -r /opt/unidock_tools
Loading

0 comments on commit 70aa9c8

Please sign in to comment.