Skip to content

Scripts: Speed up GH action, install scripts. #18

Scripts: Speed up GH action, install scripts.

Scripts: Speed up GH action, install scripts. #18

name: Build and Test
permissions: read-all
on:
push:
branches:
- master
- develop
- gh-actions-test
pull_request:
branches:
- master
- develop
jobs:
build-and-test:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version:
- 18.20.2
- 20.12.1
- 21.7.3
- 22.0.0
steps:
- name: Generate dynamic matrix hash
id: generate_hash
run: |
MATRIX_VARS=$(echo '${{ toJSON(matrix) }}')
MATRIX_HASH=$(echo -n "$MATRIX_VARS" | md5sum | awk '{print $1}')
echo "MATRIX_HASH=$MATRIX_HASH" >> $GITHUB_ENV
- name: Unique Matrix ID
run: |
GH_ACTION_UNIQUE_ID="${{ github.run_id }}-$MATRIX_HASH"
echo "GH_ACTION_UNIQUE_ID=$GH_ACTION_UNIQUE_ID" >> $GITHUB_ENV
- uses: actions/checkout@v4
# Install a specific version of Rust and Cargo
- name: Install specific Rust version
uses: actions-rs/toolchain@v1
with:
toolchain: 1.81.0 # Specify the Rust version you want (Cargo comes bundled)
profile: minimal
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Set up .nvmrc
run: echo v${{ matrix.node-version }} > .nvmrc
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8.18
- name: Install Dependencies (Ubuntu)
run: |
bash scripts/install-reqs.sh
# - name: Install nvm
# run: |
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
- name: Run everything
run: |
npm install -g npm@latest
npm install
bash scripts/pre.sh