CI #635
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 | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
test: | |
if: github.event.pull_request.draft == false | |
name: Foyer Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macOS-latest, ubuntu-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10"] | |
exclude: | |
- os: windows-latest | |
python-version: "3.9" | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout Branch / Pull Request | |
- name: Install Mamba (Linux) | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment-dev.yml | |
python-version: ${{ matrix.python-version }} | |
if: runner.os != 'Windows' | |
- name: Install Mamba (Windows) | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment-dev-win.yml | |
python-version: ${{ matrix.python-version }} | |
if: runner.os == 'Windows' | |
- name: Install Package | |
run: python -m pip install -e . | |
- name: Test (OS -> ${{ matrix.os }} / Python -> ${{ matrix.python-version }}) | |
run: python -m pytest -v --cov=foyer --cov-report=xml --cov-append --cov-config=setup.cfg --color yes --pyargs foyer | |
- name: Upload Coverage Report | |
uses: codecov/codecov-action@v2 | |
with: | |
name: Foyer-Coverage | |
verbose: true | |
files: ./coverage.xml | |
bleeding-edge-test: | |
if: github.event.pull_request.draft == false | |
name: Bleeding Edge mosdef Tests for Foyer | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout Branch / Pull Request | |
- name: Install Mamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment-dev.yml | |
python-version: "3.10" | |
- name: Clone mBuild and GMSO | |
run: | | |
git clone https://github.com/mosdef-hub/mbuild.git | |
git clone https://github.com/mosdef-hub/gmso.git | |
- name: Update Environment with mbuild/gmso Dependencies | |
run: | | |
micromamba update --name foyer-dev --file mbuild/environment.yml | |
micromamba update --name foyer-dev --file gmso/environment.yml | |
- name: Install Packages from Source | |
run: | | |
pip install -e mbuild | |
pip install -e gmso | |
pip install -e . | |
- name: Run Bleeding Edge Tests | |
run: | | |
python -m pytest -v --color yes --pyargs foyer | |
docker: | |
runs-on: ubuntu-latest | |
needs: test | |
name: Build Docker Image | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Get Tagged Version | |
run: | | |
echo "DOCKER_TAGS=mosdef/foyer:${GITHUB_REF_NAME}, mosdef/foyer:stable" >> $GITHUB_ENV if: github.ref_type == 'tag' | |
- name: Get Push Version | |
run: | | |
echo "DOCKER_TAGS=mosdef/foyer:${GITHUB_REF_NAME}, mosdef/foyer:stable" >> $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@v4 | |
with: | |
push: true | |
tags: ${{ env.DOCKER_TAGS }} |