Skip to content

Commit d01cbb2

Browse files
committed
ci: Re-enable conda env caching with stable path
1 parent d5ee389 commit d01cbb2

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

.github/scripts/setup-chipyard.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ cd "${CHIPYARD_DIR}"
1111

1212
if [[ "${CACHE_HIT}" == "true" ]]; then
1313
echo "[CI] Cache hit! Skipping conda and toolchain steps"
14-
export RISCV="${CHIPYARD_DIR}/.conda-env/riscv-tools"
14+
export RISCV="${CHIPYARD_CONDA_ENV_PATH}/riscv-tools"
1515
[ -d "${RISCV}" ] || ( echo "error: ${RISCV} does not exist!" && exit 1 )
1616
source $(conda info --base)/etc/profile.d/conda.sh
17-
conda activate "${CHIPYARD_DIR}/.conda-env"
18-
./build-setup.sh riscv-tools --skip-conda --skip-toolchain --skip-precompile --skip-firesim --skip-marshal
17+
conda activate "${CHIPYARD_CONDA_ENV_PATH}"
18+
./build-setup.sh riscv-tools --conda-env-name "${CHIPYARD_CONDA_ENV_NAME}" \
19+
--skip-conda --skip-toolchain --skip-precompile --skip-firesim --skip-marshal
1920
else
20-
./build-setup.sh riscv-tools --skip-precompile --skip-firesim --skip-marshal
21+
./build-setup.sh riscv-tools --conda-env-name "${CHIPYARD_CONDA_ENV_NAME}" \
22+
--skip-precompile --skip-firesim --skip-marshal
2123
fi

.github/workflows/ci.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
git clone --depth 1 --branch graphics "https://github.com/ucb-bar/chipyard.git" "${CHIPYARD_DIR}"
4242
cd "${CHIPYARD_DIR}"
4343
echo "CHIPYARD_HASH=$(git rev-parse HEAD)" >> "${GITHUB_ENV}"
44+
# cross-workflow shared conda env
45+
echo "CHIPYARD_CONDA_ENV_NAME=chipyard-$(git rev-parse HEAD)" >> "${GITHUB_ENV}"
4446
# for caching
4547
ln -sf "${CHIPYARD_DIR}" "${GITHUB_WORKSPACE}/${CHIPYARD_RELPATH}"
4648
@@ -51,6 +53,11 @@ jobs:
5153
auto-activate-base: true
5254
activate-environment: ""
5355

56+
- name: Setup conda env path
57+
run: |
58+
set -x
59+
echo "CHIPYARD_CONDA_ENV_PATH=$(conda info --base)/${CHIPYARD_CONDA_ENV_NAME} >> ${GITHUB_ENV}"
60+
5461
- name: Install cargo
5562
uses: dtolnay/rust-toolchain@stable
5663

@@ -65,14 +72,14 @@ jobs:
6572
~/.cache/coursier
6673
key: scala-${{ hashFiles('**/*.sbt', '**/project/**') }}-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NUMBER }}
6774

68-
# - name: Cache conda-env
69-
# id: cache-conda-env
70-
# uses: actions/cache@v5
71-
# with:
72-
# path: |
73-
# ${{ env.CHIPYARD_RELPATH }}/.conda-env
74-
# ${{ env.CHIPYARD_RELPATH }}/env.sh
75-
# key: chipyard-${{ env.CHIPYARD_HASH }}-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NUMBER }}
75+
- name: Cache conda-env
76+
id: cache-conda-env
77+
uses: actions/cache@v5
78+
with:
79+
path: |
80+
${{ env.CHIPYARD_CONDA_ENV_PATH }}
81+
${{ env.CHIPYARD_RELPATH }}/env.sh
82+
key: chipyard-${{ env.CHIPYARD_HASH }}-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NUMBER }}
7683

7784
- name: Setup Chipyard
7885
run: |
@@ -139,7 +146,8 @@ jobs:
139146
needs: [run-soc-isa-tests, run-core-isa-tests, run-cosim-isa-tests]
140147
if: always()
141148
steps:
142-
- name: Cleanup workspace and chipyard
149+
- name: Cleanup workspace, chipyard and conda
143150
run: |
144151
[ -d "${{ github.workspace }}" ] && rm -rf "${{ github.workspace }}"
145152
[ -d "${CHIPYARD_DIR}" ] && rm -rf "${CHIPYARD_DIR}"
153+
[ -d "${CHIPYARD_CONDA_ENV_PATH}" ] && rm -rf "${CHIPYARD_CONDA_ENV_PATH}"

0 commit comments

Comments
 (0)