diff --git a/.github/actions/restore_or_install_byond/action.yml b/.github/actions/restore_or_install_byond/action.yml index a4b9ce9da6d..4b07a612558 100644 --- a/.github/actions/restore_or_install_byond/action.yml +++ b/.github/actions/restore_or_install_byond/action.yml @@ -1,4 +1,4 @@ -# This is a reusable workflow to restore BYOND from a cache, or to install it otherwise. +# This action attempts to restore BYOND from a cache, or to install it otherwise. name: Restore or Install BYOND description: Attempts to restore a specified BYOND version from cache; if it can't, it installs it. diff --git a/.github/actions/setup_node/action.yml b/.github/actions/setup_node/action.yml new file mode 100644 index 00000000000..120dbf4639b --- /dev/null +++ b/.github/actions/setup_node/action.yml @@ -0,0 +1,26 @@ +# This action is a wrapper around `actions/setup-node`, to use the version specified in +# `dependencies.sh`. +name: Setup Node +description: Install Node using the version specified in `dependencies.sh`; additionally, restores the Yarn cache if one exists + +inputs: + restore-yarn-cache: + description: 'If `true`, restores the Yarn cache alongside installing node.' + required: false + type: boolean + default: false + +runs: + using: composite + steps: + - name: Configure Node version + shell: bash + run: | + source dependencies.sh + echo "NODE_VERSION_REQUIRED=$NODE_VERSION_LTS" >> $GITHUB_ENV + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION_REQUIRED }} + cache: ${{ fromJSON(inputs.restore-yarn-cache) && 'yarn' || '' }} + cache-dependency-path: ${{ fromJSON(inputs.restore-yarn-cache) && 'tgui/yarn.lock' || '' }} diff --git a/.github/workflows/ci_suite.yml b/.github/workflows/ci_suite.yml index 708f0fda602..16b2864b749 100644 --- a/.github/workflows/ci_suite.yml +++ b/.github/workflows/ci_suite.yml @@ -42,20 +42,10 @@ jobs: key: ${{ runner.os }}-spacemandmm-${{ hashFiles('dependencies.sh') }} restore-keys: | ${{ runner.os }}-spacemandmm- - - name: Restore Yarn cache - uses: actions/cache@v4 + - name: Setup Node + uses: ./.github/actions/setup_node with: - path: tgui/.yarn/cache - key: ${{ runner.os }}-yarn-${{ hashFiles('tgui/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Restore Node cache - uses: actions/cache@v4 - with: - path: ~/.nvm - key: ${{ runner.os }}-node-${{ hashFiles('dependencies.sh') }} - restore-keys: | - ${{ runner.os }}-node- + restore-yarn-cache: true - name: Restore Bootstrap cache uses: actions/cache@v4 with: @@ -89,7 +79,6 @@ jobs: - name: Install Tools run: | pip3 install setuptools - bash tools/ci/install_node.sh bash tools/ci/install_spaceman_dmm.sh dreamchecker bash tools/ci/install_ripgrep.sh tools/bootstrap/python -c '' @@ -149,6 +138,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup Node + uses: ./.github/actions/setup_node - name: Restore BYOND from Cache uses: ./.github/actions/restore_or_install_byond - name: Compile All Maps @@ -258,13 +249,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Restore Yarn cache - uses: actions/cache@v4 + - name: Setup Node + uses: ./.github/actions/setup_node with: - path: tgui/.yarn/cache - key: ${{ runner.os }}-yarn-${{ hashFiles('tgui/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- + restore-yarn-cache: true - name: Compile run: pwsh tools/ci/build.ps1 env: diff --git a/.github/workflows/run_integration_tests.yml b/.github/workflows/run_integration_tests.yml index 6afc99b7261..c2dcc421a91 100644 --- a/.github/workflows/run_integration_tests.yml +++ b/.github/workflows/run_integration_tests.yml @@ -44,6 +44,8 @@ jobs: mysql -u root -proot tg_ci < SQL/tgstation_schema.sql mysql -u root -proot -e 'CREATE DATABASE tg_ci_prefixed;' mysql -u root -proot tg_ci_prefixed < SQL/tgstation_schema_prefixed.sql + - name: Setup Node + uses: ./.github/actions/setup_node - name: Install rust-g run: | bash tools/ci/install_rust_g.sh diff --git a/tools/ci/install_node.sh b/tools/ci/install_node.sh deleted file mode 100644 index f18fb49865e..00000000000 --- a/tools/ci/install_node.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -euo pipefail - -source dependencies.sh - -if [[ -e ~/.nvm/nvm.sh ]]; then - source ~/.nvm/nvm.sh - nvm install $NODE_VERSION_LTS - nvm use $NODE_VERSION_LTS -fi