From fa9cfe603461dc621ffe9b1c8a7e127f1dae36d8 Mon Sep 17 00:00:00 2001 From: SinusFox Date: Mon, 14 Oct 2024 16:26:30 +0000 Subject: [PATCH] Adding git lab workflows --- .gitlab-ci.yml | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..37ddf6b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,80 @@ +# Define the stages of the pipeline +stages: + - install + - build + - test + - deploy + +# Job to install dependencies +install_dependencies: + stage: install + image: node:16 + script: + - npm ci + cache: + paths: + - node_modules/ + artifacts: + paths: + - node_modules/ + # Run automatically on PRs to main + only: + - merge_requests + - main + # Allow manual execution + when: manual + +# Job to build the Next.js project +build_nextjs: + stage: build + image: node:16 + script: + - npm run build + dependencies: + - install_dependencies + cache: + paths: + - .next/ + artifacts: + paths: + - .next/ + # Run automatically on PRs to main + only: + - merge_requests + - main + # Allow manual execution + when: manual + +# Job to run tests +run_tests: + stage: test + image: node:16 + script: + - npm test # Replace with your test command (e.g. jest) + dependencies: + - install_dependencies + artifacts: + when: always + paths: + - test-reports/ + # Run automatically on PRs to main + only: + - merge_requests + - main + # Allow manual execution + when: manual + +# Deploy step (runs only on merge to main) +deploy: + stage: deploy + script: + - mkdir public + - cp -r .next/* public # Example for GitLab Pages, adjust as needed + artifacts: + paths: + - public + # Only run on merge to main branch + only: + - main + # Allow manual execution + when: manual