Skip to content

Commit f307987

Browse files
committed
Workaround for weird miniconda environment
- Switch to Mambaforge - Switch to caching the environment, not the packages
1 parent c4c63d2 commit f307987

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

.github/workflows/blog.yaml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,50 @@ on:
77
- "environment.yml"
88
- "dependencies.R"
99
- ".github/workflows/blog.yaml"
10+
workflow_dispatch:
1011

1112
jobs:
1213
blog:
1314
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: bash -l {0}
18+
env:
19+
RETICULATE_PYTHON: /usr/share/miniconda3/envs/www-main/bin/python
1420
steps:
1521
- uses: actions/checkout@v3
1622
with:
1723
# submodules: true # Fetch Hugo themes (true OR recursive)
1824
fetch-depth: 3
19-
- name: Cache Conda
20-
uses: actions/[email protected]
21-
with:
22-
path: ~/conda_pkgs_dir
23-
key: ${{ runner.os }}-conda6-${{ hashFiles('environment.yml') }}
24-
restore-keys: |
25-
${{ runner.os }}-conda6-
2625
- uses: conda-incubator/setup-miniconda@v2
2726
with:
2827
python-version: 3.9
29-
mamba-version: "*"
30-
channels: conda-forge,defaults
31-
channel-priority: true
3228
activate-environment: www-main
33-
environment-file: environment.yml
34-
auto-activate-base: false
29+
miniforge-variant: Mambaforge
30+
miniforge-version: latest
31+
use-mamba: true
3532
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
36-
# - name: Conda info
37-
# shell: bash -l {0}
38-
# run: |
39-
# conda info
40-
# conda list
33+
- name: Get Date
34+
id: get-date
35+
run: echo "name=today::$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
36+
shell: bash
37+
- name: Cache Conda env
38+
uses: actions/cache@v3
39+
with:
40+
path: ${{ env.CONDA }}/envs
41+
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER }}
42+
env:
43+
# Increase this value to reset cache if etc/example-environment.yml has not changed
44+
CACHE_NUMBER: 0
45+
id: cache
46+
- name: Update environment
47+
run: mamba env update -n www-main -f environment.yml
48+
if: steps.cache.outputs.cache-hit != 'true'
49+
- name: Conda info
50+
run: |
51+
conda info
52+
conda list
4153
- name: Install R dependencies
42-
shell: bash -l {0}
4354
env:
4455
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4556
run: |
@@ -54,10 +65,8 @@ jobs:
5465
${{ runner.os }}-blogdown2-${{ hashFiles('environment.yml') }}-
5566
${{ runner.os }}-blogdown2-
5667
- name: Build site
57-
shell: bash -l {0}
5868
run: |
5969
npm run build:blog
60-
6170
- uses: actions/upload-artifact@v3
6271
with:
6372
name: blog
@@ -79,7 +88,6 @@ jobs:
7988
run: npm run lint
8089
- name: Build
8190
run: npm run build
82-
8391
- uses: actions/upload-artifact@v3
8492
with:
8593
name: website

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dependencies:
5050
- r-vroom
5151
- r-urltools
5252
- r-base64url
53+
- r-readr
5354
- pandoc
5455
- fiona
5556
- geopandas

0 commit comments

Comments
 (0)