diff --git a/.github/actions/nimbus-build-system/action.yml b/.github/actions/nimbus-build-system/action.yml index 552b8216..590c5571 100644 --- a/.github/actions/nimbus-build-system/action.yml +++ b/.github/actions/nimbus-build-system/action.yml @@ -150,14 +150,13 @@ runs: uses: actions/cache@v3 with: path: NimBinaries - key: ${{ inputs.os }}-${{ inputs.cpu }}-nim-cache-${{ env.cache_nonce }}-${{ github.run_id }} - restore-keys: ${{ inputs.os }}-${{ inputs.cpu }}-nim-cache-${{ env.cache_nonce }} + key: ${{ inputs.os }}-${{ inputs.cpu }}-cache-${{ env.cache_nonce }}-${{ github.run_id }} + restore-keys: ${{ inputs.os }}-${{ inputs.cpu }}-cache-${{ env.cache_nonce }} - name: Build Nim and Codex dependencies shell: ${{ inputs.shell }} {0} run: | - . ./env.sh - make -j${ncpu} CI_CACHE=NimBinaries ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update + ./env.sh make -j${ncpu} CI_CACHE=NimBinaries ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update echo - nim --version + ./env.sh nim --version diff --git a/env.sh b/env.sh index 62b8d9f2..f0a7c25b 100755 --- a/env.sh +++ b/env.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +# This is the compiler version that will get used everywher. NIM_VERSION="f45bdea94ac4ed9a9bae03426275456aeb0cab2a" NIM_REPO_URL="https://github.com/gmega/Nim" @@ -8,6 +9,16 @@ NIM_REPO_URL="https://github.com/gmega/Nim" REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})" ABS_PATH="$(cd ${REL_PATH}; pwd)" +ENV_FILE="${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh" + export NIM_COMMIT="${NIM_COMMIT:-${NIM_VERSION}}" -export NIM_REPO="${NIM_REPO_URL:-${NIM_REPO_URL}}" -source ${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh +if ! [ -f "$ENV_FILE" ]; then + # Before the first "make update", the env file doesn't exist, so just run + # the command that comes after (without a child shell), if any. Running + # ./env.sh make update will cause the right compiler to be built right from + # the start. + echo "Nimbus env file not found" + "$@" +else + source "${ENV_FILE}" +fi