Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GitHub Actions #6

Merged
merged 6 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build and Test

on: [push, pull_request]

jobs:
build-and-test:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ${{ matrix.os }}

defaults:
run:
shell: bash -l {0}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build-type: [Release]

steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true

- name: Show conda installation info
run: conda info

- name: Install build tools and dependencies into env
run: |
mamba install make cmake c-compiler pkg-config
mamba list

- name: Make cmake build directory
run: cmake -E make_directory build

- name: Configure cmake (unix)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
working-directory: ${{ github.workspace }}/build
run: |
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX

- name: Configure cmake (windows)
if: matrix.os == 'windows-latest'
working-directory: ${{ github.workspace }}\build
shell: pwsh
run: |
& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" x86

cmake .. `
-DCMAKE_INSTALL_PREFIX:PATH=$env:CONDA_PREFIX `
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}

- name: Build
working-directory: ${{ github.workspace }}/build
run: cmake --build . --target install --config ${{ matrix.build-type }}

- name: Test
run: |
test -f $CONDA_PREFIX/include/bmi.h
test -f $CONDA_PREFIX/lib/pkgconfig/bmic.pc
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![DOI](https://zenodo.org/badge/27887433.svg)](https://zenodo.org/badge/latestdoi/27887433)
[![Build Status](https://travis-ci.org/csdms/bmi-c.svg?branch=master)](https://travis-ci.org/csdms/bmi-c)
[![Build and Test](https://github.com/csdms/bmi-c/actions/workflows/test.yml/badge.svg)](https://github.com/csdms/bmi-c/actions/workflows/test.yml)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/bmi-c/badges/version.svg)](https://anaconda.org/conda-forge/bmi-c)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/bmi-c/badges/platforms.svg)](https://anaconda.org/conda-forge/bmi-c)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/bmi-c/badges/downloads.svg)](https://anaconda.org/conda-forge/bmi-c)
Expand Down