-
Notifications
You must be signed in to change notification settings - Fork 7
91 lines (78 loc) · 2.76 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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.9", "3.10"]
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@v1
- name: Login to DockerHub
uses: docker/login-action@v1
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@v2
with:
push: true
tags: ${{ env.DOCKER_TAGS }}