|
| 1 | +# This file is a template, and might need editing before it works on your project. |
| 2 | +# This is a sample GitLab CI/CD configuration file that should run without any modifications. |
| 3 | +# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts, |
| 4 | +# it uses echo commands to simulate the pipeline execution. |
| 5 | +# |
| 6 | +# A pipeline is composed of independent jobs that run scripts, grouped into stages. |
| 7 | +# Stages run in sequential order, but jobs within stages run in parallel. |
| 8 | +# |
| 9 | +# For more information, see: https://docs.gitlab.com/ee/ci/yaml/#stages |
| 10 | +# |
| 11 | +# You can copy and paste this template into a new `.gitlab-ci.yml` file. |
| 12 | +# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword. |
| 13 | +# |
| 14 | +# To contribute improvements to CI/CD templates, please follow the Development guide at: |
| 15 | +# https://docs.gitlab.com/development/cicd/templates/ |
| 16 | +# This specific template is located at: |
| 17 | +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml |
| 18 | + |
| 19 | +stages: # List of stages for jobs, and their order of execution |
| 20 | + - build |
| 21 | + - test |
| 22 | + - deploy |
| 23 | + |
| 24 | +build-job: # This job runs in the build stage, which runs first. |
| 25 | + stage: build |
| 26 | + script: |
| 27 | + - echo "Compiling the code..." |
| 28 | + - echo "Compile complete." |
| 29 | + |
| 30 | +unit-test-job: # This job runs in the test stage. |
| 31 | + stage: test # It only starts when the job in the build stage completes successfully. |
| 32 | + script: |
| 33 | + - echo "Running unit tests... This will take about 60 seconds." |
| 34 | + - sleep 60 |
| 35 | + - echo "Code coverage is 90%" |
| 36 | + |
| 37 | +lint-test-job: # This job also runs in the test stage. |
| 38 | + stage: test # It can run at the same time as unit-test-job (in parallel). |
| 39 | + script: |
| 40 | + - echo "Linting code... This will take about 10 seconds." |
| 41 | + - sleep 10 |
| 42 | + - echo "No lint issues found." |
| 43 | + |
| 44 | +deploy-job: # This job runs in the deploy stage. |
| 45 | + stage: deploy # It only runs when *both* jobs in the test stage complete successfully. |
| 46 | + environment: production |
| 47 | + script: |
| 48 | + - echo "Deploying application..." |
| 49 | + - echo "Application successfully deployed." |
0 commit comments