CI #940
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
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
schedule: | |
- cron: "0 0 * * *" | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
test: | |
if: github.event.pull_request.draft == false | |
name: Unit-Test (${{ matrix.os }}, Python ${{ matrix.python-version }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macOs-latest"] | |
python-version: ["3.10", "3.11"] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: create dir | |
run: sudo mkdir /opt/gomc_build | |
- name: clone the GOMC repositrory version 2.75a | |
run: sudo git clone https://github.com/GOMC-WSU/GOMC.git --branch v2.75a /opt/gomc_build/GOMC | |
- name: install cmake | |
run: pip install cmake | |
- name: which python | |
run: which python | |
- name: change permission on GOMC make file and run it | |
run: cd /opt/gomc_build/GOMC/ && sudo chmod u+x metamake.sh && sudo ./metamake.sh NVT | |
- name: Checkout Branch / Pull Request | |
uses: actions/checkout@v4 | |
- name: Install Mamba | |
#uses: mamba-org/setup-micromamba@v1 | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
environment-file: environment.yml | |
create-args: >- | |
python=${{ matrix.python-version }} | |
- name: Install Package | |
run: python -m pip install -e . | |
- name: Add GOMC path as symlink to conda bin | |
run: sudo ln -s /opt/gomc_build/GOMC/bin/GOMC_CPU_NVT $CONDA_PREFIX/bin | |
- name: Test (OS -> ${{ matrix.os }} / Python -> ${{ matrix.python-version }}) | |
run: python -m pytest -v --cov=mosdef_dihedral_fit --cov-report=xml --cov-append --cov-config=setup.cfg --color yes --pyargs mosdef_dihedral_fit | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: GOMC-WSU/MoSDeF-dihedral-fit | |
docker: | |
runs-on: 'ubuntu-latest' | |
needs: test | |
name: 'Build Docker Image' | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Get Tagged Version | |
run: | | |
echo "DOCKER_TAGS=${{ secrets.DOCKERHUB_USERNAME }}/mosdef-dihedral-fit:${GITHUB_REF_NAME}, ${{ secrets.DOCKERHUB_USERNAME }}/mosdef-dihedral-fit:stable" >> $GITHUB_ENV | |
if: github.ref_type == 'tag' | |
- name: Get Push Version | |
run: | | |
echo "DOCKER_TAGS=${{ secrets.DOCKERHUB_USERNAME }}/mosdef-dihedral-fit:${GITHUB_REF_NAME}, ${{ secrets.DOCKERHUB_USERNAME }}/mosdef-dihedral-fit:latest" >> $GITHUB_ENV | |
if: github.ref_type == 'branch' | |
- name: Docker Image Info | |
run: | | |
echo Docker Image tags: ${DOCKER_TAGS} | |
- name: Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ env.DOCKER_TAGS }} |