Check node version
This commit is contained in:
parent
42a77a5cd5
commit
0e0a85df82
5 changed files with 20 additions and 12 deletions
8
.github/workflows/check.yml
vendored
8
.github/workflows/check.yml
vendored
|
|
@ -5,6 +5,7 @@ on:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
@ -31,12 +32,5 @@ jobs:
|
||||||
toolchain: "1.89.0"
|
toolchain: "1.89.0"
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
|
|
||||||
- name: Setup rust
|
|
||||||
run: |
|
|
||||||
which sqlx || cargo install sqlx-cli
|
|
||||||
cd sync-server
|
|
||||||
sqlx database create --database-url sqlite://db.sqlite3
|
|
||||||
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3
|
|
||||||
|
|
||||||
- name: Lint & test
|
- name: Lint & test
|
||||||
run: scripts/check.sh
|
run: scripts/check.sh
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
./scripts/utils/check-node.sh
|
||||||
|
|
||||||
cd docs
|
cd docs
|
||||||
|
|
||||||
npm ci
|
npm ci
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,15 @@ if [[ "$1" == "--fix" ]]; then
|
||||||
echo "Running in fix mode - will automatically fix linting and formatting issues"
|
echo "Running in fix mode - will automatically fix linting and formatting issues"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
./scripts/utils/check-node.sh
|
||||||
|
|
||||||
echo "Running checks in sync-server"
|
echo "Running checks in sync-server"
|
||||||
|
|
||||||
cd sync-server
|
cd sync-server
|
||||||
|
which sqlx || cargo install sqlx-cli
|
||||||
|
sqlx database create --database-url sqlite://db.sqlite3
|
||||||
|
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3
|
||||||
|
|
||||||
cargo test --verbose
|
cargo test --verbose
|
||||||
|
|
||||||
if [[ "$FIX_MODE" == true ]]; then
|
if [[ "$FIX_MODE" == true ]]; then
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,7 @@ set -o pipefail
|
||||||
NO_COLOR=1
|
NO_COLOR=1
|
||||||
FORCE_COLOR=0
|
FORCE_COLOR=0
|
||||||
|
|
||||||
node_version=$(node -v | sed 's/^v\([0-9]*\).*/\1/')
|
./scripts/utils/check-node.sh
|
||||||
if [ "$node_version" != "22" ]; then
|
|
||||||
echo "Error: This script requires Node.js version 22, found: $node_version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the argument is provided
|
# Check if the argument is provided
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
|
|
|
||||||
9
scripts/utils/check-node.sh
Executable file
9
scripts/utils/check-node.sh
Executable file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
node_version=$(node -v | sed 's/^v\([0-9]*\).*/\1/')
|
||||||
|
if [ "$node_version" != "22" ]; then
|
||||||
|
echo "Error: This script requires Node.js version 22, found: $node_version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue