Skip to content

add test stage in actions #2

add test stage in actions

add test stage in actions #2

Workflow file for this run

name: Build and Test with Mamba
on:
push:
branches:
- main
- build-actions
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: 'latest' # any version from https://github.com/mamba-org/micromamba-releases
environment-file: environment.yaml
init-shell: >-
bash
cache-environment: true
post-cleanup: 'all'
- name: Install dependencies
run: |
micromamba run -n mattersim pip install .
- name: Save Conda environment as artifact
run: |
tar -czf mattersim-env.tar.gz -C $MAMBA_ROOT_PREFIX/envs/mattersim .
continue-on-error: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: mattersim-env
path: mattersim-env.tar.gz
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: mattersim-env
- name: Extract environment
run: |
mkdir -p $HOME/micromamba/envs/mattersim
tar -xzf mattersim-env.tar.gz -C $HOME/micromamba/envs/mattersim/
micromamba shell init -s bash -p $HOME/micromamba
source ~/.bashrc
micromamba run -n mattersim pytest -s tests