|
| 1 | +# Following: |
| 2 | +# https://dev.to/epassaro/caching-anaconda-environments-in-github-actions-5hde |
| 3 | +# https://github.com/epassaro/cache-conda-envs |
| 4 | + |
| 5 | +name: test_dedalus3 |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | +env: |
| 9 | + CACHE_NUMBER: 0 # increase to reset cache manually |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - os: ubuntu-latest |
| 16 | + label: ubuntu-latest |
| 17 | + prefix: /usr/share/miniconda3/envs/dedalus3 |
| 18 | + - os: macos-latest |
| 19 | + label: macos-latest |
| 20 | + prefix: /Users/runner/miniconda3/envs/dedalus3 |
| 21 | + name: ${{ matrix.label }} |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + steps: |
| 24 | + - name: Setup miniforge |
| 25 | + uses: conda-incubator/setup-miniconda@v2 |
| 26 | + with: |
| 27 | + miniforge-version: latest |
| 28 | + auto-activate-base: true |
| 29 | + activate-environment: "" |
| 30 | + - name: Set cache date |
| 31 | + run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV |
| 32 | + - name: Check stack cache |
| 33 | + uses: actions/cache@v2 |
| 34 | + with: |
| 35 | + path: ${{ matrix.prefix }} |
| 36 | + key: ${{ matrix.label }}-stack-${{ env.DATE }}-${{ env.CACHE_NUMBER }} |
| 37 | + id: cache |
| 38 | + - name: Run conda installation (stack cache miss) |
| 39 | + if: steps.cache.outputs.cache-hit != 'true' |
| 40 | + shell: bash -l {0} |
| 41 | + run: | |
| 42 | + curl https://raw.githubusercontent.com/DedalusProject/dedalus_conda/master/install_dedalus3_conda.sh --output install_dedalus3_conda.sh |
| 43 | + bash install_dedalus3_conda.sh |
| 44 | + - name: Checkout repository |
| 45 | + uses: actions/checkout@v2 |
| 46 | + - name: Update Dedalus from repository |
| 47 | + shell: bash -l {0} |
| 48 | + run: | |
| 49 | + conda activate dedalus3 |
| 50 | + pip uninstall -y dedalus3 |
| 51 | + pip install --no-cache . |
| 52 | + - name: Test Dedalus |
| 53 | + shell: bash -l {0} |
| 54 | + run: | |
| 55 | + conda activate dedalus3 |
| 56 | + python3 -m dedalus test |
0 commit comments