From 381c67562e68c57c2abbd3d7649adb5f77c2f3c0 Mon Sep 17 00:00:00 2001 From: Mohammad Rad Date: Wed, 23 Oct 2024 02:49:21 -0700 Subject: [PATCH] add Jenkinsfile --- Jenkinsfile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..3ff47c0c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,51 @@ +pipeline { + agent { + docker { + image 'node:20' + args '-u root' // Run as root to handle permissions + } + } + + stages { + stage('Checkout') { + steps { + // First configure git to trust the workspace directory + sh 'git config --global --add safe.directory "*"' + + // Then do the git checkout + git branch: 'feat/tdd', + url: 'https://github.com/m2rads/shortest-test' + + // Print current branch for verification + sh 'git branch --show-current' + } + } + + stage('Setup PNPM') { + steps { + sh ''' + npm install -g pnpm + pnpm --version + ''' + } + } + + stage('Install Dependencies') { + steps { + sh 'pnpm install' + } + } + + stage('Install Coverage Tool') { + steps { + sh 'pnpm add -D @vitest/coverage-v8' + } + } + + stage('Run Tests') { + steps { + sh 'npx vitest run' + } + } + } +} \ No newline at end of file