Cleanup file names and CMakeLists.txt files #9
Workflow file for this run
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: Build library and run tests | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled' | |
required: false | |
default: false | |
env: | |
# Increase to reset cache manually | |
CACHE_NUMBER: 0 | |
MYLIB_ENV: /usr/share/miniconda/envs/mylib-dev | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
PUSH_ON_MAIN: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Setup GitHub actions | |
id: setup_actions | |
uses: actions/checkout@v3 | |
- name: Setup tmate session | |
id: setup_tmate | |
uses: mxschmitt/[email protected] | |
if: ${{ inputs.debug_enabled }} | |
- name: Setup a new project | |
id: setup_new_project | |
run: | | |
./setup.sh -r mylib -n | |
- name: Setup conda environment | |
id: setup_conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: mylib-dev | |
use-mamba: false | |
# https://dev.to/epassaro/caching-anaconda-environments-in-github-actions-5hde | |
- name: Cache conda environment | |
id: cache_conda | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.MYLIB_ENV }} | |
key: conda-${{ runner.os }}-${{ hashFiles('environment-dev.yml') }}-${{ hashFiles('requirements-dev.txt') }}-${{ env.CACHE_NUMBER }} | |
- name: Update conda environment | |
id: update_env | |
run: | | |
conda env update -n mylib-dev -f environment-dev.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Build tests | |
id: build_tests | |
run: | | |
./mylibcfg -enable-tests | |
./mylib -install | |
- name: Test the renamed repo | |
id: run_tests | |
run: | | |
./install/tests/mylib-000-init | |
- name: Block to allow inspecting failures | |
id: block_for_tmate | |
run: sleep 30m | |
if: ${{ failure() && inputs.debug_enabled }} |