Commit 1b2d30b3 authored by Jesse Mapel's avatar Jesse Mapel Committed by Jesse Mapel
Browse files

Initial GH actions

parent ac855e71
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
name: Pull-Request-CI

on:
  pull_request:
    branches:
      - dev
  push:
    branches:
      - dev

jobs:
  Build-and-Test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
       os: [ubuntu-latest, macos-latest]
       python-version: ["3.7", "3.8", "3.9"]
    defaults:
      run:
        shell: bash -l {0}
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - uses: conda-incubator/setup-miniconda@v2
        with:
          miniconda-version: "latest"
          activate-environment: usgscsm
          environment-file: environment.yml
          auto-activate-base: false
          auto-update-conda: true
          python-version: ${{ matrix.python-version }}
      - name: Check build environment
        run: |
          conda list
      - name: Build Package
        run: |
          mkdir -p build
          cd build
          cmake -DCMAKE_BUILD_TYPE=RELEASE -DCOVERAGE=ON ..
          cmake --build .
      - name: Test Package
        run: |
          cd build
          ctest -VV
      - name: Upload Coverage
        uses: codecov/codecov-action@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
          verbose: true
        if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'

.travis.yml

deleted100644 → 0
+0 −67
Original line number Diff line number Diff line
language: cpp
sudo: false

branches:
  only:
    - master
    - dev

matrix:
  include:
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-7
      env:
        - MATRIX_EVAL="CXX=g++-7 && CC=gcc-7"
    - os: osx
      osx_image: xcode9.4
      env:
        - MATRIX_EVAL="CXX=clang++ && CC=clang"

before_install:
  - echo "$TRAVIS_PULL_REQUEST"
  - eval "${MATRIX_EVAL}"
  - |
    if [ "$TRAVIS_OS_NAME" == "linux" ]; then
      pip install --user cpp-coveralls;
    fi
install:
  # Install a supported cmake version (>= 3.10)
  - |
    if [ "$TRAVIS_OS_NAME" == "linux" ]; then
      wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
    else
      curl -o miniconda.sh  https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh;
    fi
  - bash miniconda.sh -b -p $HOME/miniconda
  - source $HOME/miniconda/etc/profile.d/conda.sh
  - conda env create -n usgscsm -f environment.yml

script:
  - conda activate usgscsm
  - mkdir build
  - cd build
  - cmake -DUSGSCSM_EXTERNAL_DEPS=ON -DCOVERAGE=ON ..
  - cmake --build .
  - ctest -VV
  - cd ..

after_success:
  - conda install -y -q conda-build anaconda-client
  # Pull the libcsm for the build from our anaconda channel
  - conda config --add channels usgs-astrogeology
  - conda config --set anaconda_upload no
  - conda build recipe -q
  # Get the conda build output dir
  - builddir=(`conda build recipe --output`)
  # Label based on the branch and upload to anaconda.org
  - |
    if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
      anaconda -t="$CONDA_UPLOAD_TOKEN" upload $builddir;
    elif [ "$TRAVIS_BRANCH" == "dev" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
      anaconda -t="$CONDA_UPLOAD_TOKEN" upload $builddir --label dev --force;
    fi