-
Notifications
You must be signed in to change notification settings - Fork 13
add basic ci pipeline for mdmix3 #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e573169
refactor local environment and project setup
ggutierrez-sunbright f780b3c
cleanup
ggutierrez-sunbright 51d3471
initialize mdmix package and add basic ci
ggutierrez-sunbright 8e9675b
fix linting and checks
ggutierrez-sunbright 8100334
add missing exclude for ruff
ggutierrez-sunbright e49faac
Update Dockerfile
ggutierrez-sunbright File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,55 @@ | ||
| // For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
| // README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile | ||
| { | ||
| "name": "Existing Dockerfile", | ||
| "build": { | ||
| // Sets the run context to one level up instead of the .devcontainer folder. | ||
| "context": "..", | ||
| // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. | ||
| "dockerfile": "../Dockerfile", | ||
| "target": "development" | ||
| }, | ||
| "customizations": { | ||
| "vscode": { | ||
| "settings": { | ||
| "python.languageServer": "Pylance", | ||
| "python.testing.pytestEnabled": true, | ||
| "python.testing.pytestArgs": [ | ||
| "tests" | ||
| ], | ||
| "[python]": { | ||
| "editor.formatOnSave": true, | ||
| "editor.codeActionsOnSave": { | ||
| "source.organizeImports": true | ||
| }, | ||
| "editor.defaultFormatter": "charliermarsh.ruff" | ||
| }, | ||
| "files.autoSave": "afterDelay", | ||
| "files.autoSaveDelay": 1000 | ||
| }, | ||
| "extensions": [ | ||
| "ms-python.python", | ||
| "littlefoxteam.vscode-python-test-adapter", | ||
| "ms-vsliveshare.vsliveshare", | ||
| "mhutchie.git-graph", | ||
| "ms-toolsai.jupyter", | ||
| "charliermarsh.ruff" | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| // Features to add to the dev container. More info: https://containers.dev/features. | ||
| // "features": {}, | ||
|
|
||
| // Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
| // "forwardPorts": [], | ||
|
|
||
| // Uncomment the next line to run commands after the container is created. | ||
| // "postCreateCommand": "cat /etc/os-release", | ||
|
|
||
| // Configure tool-specific properties. | ||
| // "customizations": {}, | ||
|
|
||
| // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. | ||
| // "remoteUser": "devcontainer" | ||
| } |
This file contains hidden or 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,68 @@ | ||
| name: Lint and Test | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [ "mdmix3-dev" ] | ||
|
|
||
| pull_request: | ||
| branches: [ "mdmix3-dev" ] | ||
|
|
||
| jobs: | ||
| build-dev: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| outputs: | ||
| REPOSITORY: ${{ steps.repository_lower.outputs.REPOSITORY }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Docker buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log into registry ghcr.io | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: set repository lower case | ||
| id: repository_lower | ||
| run: | | ||
| echo REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| tags: ghcr.io/${{ steps.repository_lower.outputs.REPOSITORY }}_dev | ||
| push: true | ||
| target: development | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| test: | ||
| needs: build-dev | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ghcr.io/${{ needs.build-dev.outputs.REPOSITORY }}_dev | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run ruff | ||
| run: | | ||
| ruff check . | ||
|
|
||
| - name: Run mypy | ||
| run: | | ||
| mypy . | ||
|
|
||
| - name: Run pytest | ||
| run: | | ||
| pytest -v . |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,21 +1,22 @@ | ||
| FROM ggutierrezbio/ambertools20 | ||
| ARG CONDA_PREFIX="/opt/SOFT/miniconda3" | ||
| ENV PATH="$CONDA_PREFIX/bin:${PATH}" | ||
| ARG PATH="$CONDA_PREFIX/bin:${PATH}" | ||
|
|
||
| SHELL [ "/bin/bash", "--login", "-c" ] | ||
| RUN apt-get update && apt-get install -y wget git && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN wget \ | ||
| https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||
| && bash Miniconda3-latest-Linux-x86_64.sh -b -p $CONDA_PREFIX \ | ||
| && rm -f Miniconda3-latest-Linux-x86_64.sh | ||
| RUN conda --version | ||
|
|
||
| COPY ./environment_p27.yml ./environment_p27.yml | ||
| RUN conda env create -f environment_p27.yml | ||
| RUN echo ". $CONDA_PREFIX/etc/profile.d/conda.sh" >> ~/.bash_profile | ||
| RUN echo "conda activate mdmix-env" >> ~/.bash_profile | ||
| WORKDIR /mnt | ||
| SHELL ["conda", "run", "-n", "mdmix-env", "/bin/bash", "-c"] | ||
| ENTRYPOINT ["conda", "run", "-n", "mdmix-env", "mdmix"] | ||
| FROM continuumio/miniconda3 as base | ||
|
|
||
| ARG PYTHON_VERSION=3.12 | ||
|
|
||
| # Create environment and install ambertools | ||
| RUN conda config --add channels defaults && \ | ||
| conda config --add channels bioconda && \ | ||
| conda config --add channels conda-forge | ||
|
|
||
| # RUN apt update && apt install libnetcdf-dev -y | ||
|
|
||
| RUN conda install -y python=${PYTHON_VERSION} ambertools | ||
|
|
||
| COPY requirements.txt . | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
|
|
||
| CMD ["bash"] | ||
|
|
||
| FROM base AS development | ||
|
|
||
| COPY requirements-dev.txt . | ||
| RUN python -m pip install -r requirements-dev.txt | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,76 +1 @@ | ||
| ## pyMDMix --- http://mdmix.sourceforge.net | ||
|
|
||
| The program is distributed under GNU GPLv3 license. Find the license file | ||
| under Licenses/ folder. | ||
|
|
||
| DOCUMENTATION | ||
| ============= | ||
| All documentation on program usage is online at | ||
| http://mdmix.sourceforge.net | ||
|
|
||
| INSTALLATION | ||
| ============ | ||
|
|
||
| 1- Dependencies | ||
| --------------- | ||
| This version of pyMDMix depends on: | ||
| - ambertools>=12 | ||
| - python>=2.7 | ||
|
|
||
| make sure ambertools environment variables are set | ||
|
|
||
| 2 - Installation process | ||
| ------------------------ | ||
| it is advised to install pyMDMix in a virtual environment | ||
|
|
||
| there are three recommended ways to install pyMDMix: | ||
| 1. from the repository by | ||
| `python -m pip install [insert address here]` | ||
|
|
||
| 2. from the project's local folder after cloning the repo by | ||
| `python -m pip install .` | ||
|
|
||
| 3. Use conda or mamba: we will first create the correct conda environment which will already contain ambertools. We will then set the AMBERHOME variable within the environment and finally proceed to install pymdmix from the local git cloned files. Make sure `$CONDA_PREFIX` points to the conda installation directory (it may happen when you activate the new environment this varaible is lost, in that case change the variable for the explicit path). | ||
|
|
||
| ```bash | ||
| git clone https://github.com/CBDD/pyMDmix.git | ||
| cd pyMDMix | ||
| conda env create -f environment_p27.yml | ||
| conda activate mdmix-env | ||
| conda env config vars set AMBERHOME=$CONDA_PREFIX/envs/mdmix-env | ||
| pip install . | ||
| ``` | ||
|
|
||
| 3 - Testing | ||
| ----------- | ||
|
|
||
| You can test the package has been successfuly installed by activating | ||
| the environment and, from a folder other than the cloned repository, running | ||
| `python -m pyMDMix` | ||
| if everything went fine, you will see something like | ||
| `Welcome to MDMix 2.6` | ||
|
|
||
| The main script should have been installed correclty also. check it by running | ||
| `mdmix -h` | ||
|
|
||
| Test the program works correctly: | ||
| Move again to the package source directory and type: | ||
| > python pyMDMix/test.py all | ||
| This will run a series of source code checks. | ||
| No test should fail. | ||
|
|
||
| 4 - Using Docker | ||
| ---------------- | ||
| Build and run from a docker container using the provided Dockerfile. | ||
|
|
||
| - docker build -t pymdmix . | ||
| - docker run -v $PWD:/mnt pymdmix -h | ||
|
|
||
| The docker run command will mount the current working directory (windows users should replace $PWD by %cd%) so the container has access to the current location. Output will be also in the current working directory. | ||
| s | ||
|
|
||
| 4 - Enjoy! | ||
| ---------- | ||
| Read program usage at online documentation. | ||
|
|
||
|
|
||
| # pyMDMix |
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.