Skip to content

CI

CI #1051

Workflow file for this run

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 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Mambaforge-pytest:
name: Unit-Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
os: ["ubuntu", "macos"]
include:
- os: ubuntu
environment-file: environment.yml
miniforge-variant: Mambaforge
miniforge-version: 4.9.2-4
- os: macos
environment-file: environment.yml
miniforge-variant: Mambaforge-pypy3
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
environment-file: ${{ matrix.environment-file }}
miniforge-variant: ${{ matrix.miniforge-variant }}
miniforge-version: ${{ matrix.miniforge-version }}
python-version: ${{ matrix.python-version }}
use-mamba: true
- shell: bash -l {0}
run: |
pip install .
- shell: bash -l {0}
run: |
python -m pytest -v --color yes mosdef_gomc/tests --cov
coverage xml
echo "tests finished"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
docker:
runs-on: 'ubuntu-latest'
needs: Mambaforge-pytest
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-gomc:${GITHUB_REF_NAME}, ${{ secrets.DOCKERHUB_USERNAME }}/mosdef-gomc:stable" >> $GITHUB_ENV
if: github.ref_type == 'tag'
- name: Get Push Version
run: |
echo "DOCKER_TAGS=${{ secrets.DOCKERHUB_USERNAME }}/mosdef-gomc:${GITHUB_REF_NAME}, ${{ secrets.DOCKERHUB_USERNAME }}/mosdef-gomc: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 }}