# stages:          # List of stages for jobs, and their order of execution
#   - build
#   - test
#   - deploy

# image: rust:latest  # Uses the latest Rust Docker image as the base

# before_script:
#   - curl -fsSL https://deb.nodesource.com/setup_22.x | bash -  # Installs Node.js version 22
#   - apt-get install -y nodejs
#   - npm install -g yarn  # Installs Yarn globally using npm
#   - git config --global user.email "gitlab@cored.in"  # Set the specified email
#   - git config --global user.name "GitLab Guardian Angel"  # Set the specified user name

# build-job:       # This job runs in the build stage, which runs first.
#   stage: build
#   script:
#     - echo "Building the contract..."
#     - yarn build-contract
#     - echo "Compile complete."
#     - git add .
#     - git diff-index --quiet HEAD || git commit -m "Auto-commit by GitLab CI"  # Only commit if there are changes
#     - git push origin HEAD:main || echo "No changes to push."  # Push changes or skip if no changes
#   only:
#     - main  # Specifies that this job should only run on the main branch

# unit-test-job:   # This job runs in the test stage.
#   stage: test    # It only starts when the job in the build stage completes successfully.
#   script:
#     - echo "Running unit tests... This will take about 10 seconds."
#     - sleep 10
#     - echo "Code coverage is 90% :D"

# lint-test-job:   # This job also runs in the test stage.
#   stage: test    # It can run at the same time as unit-test-job (in parallel).
#   script:
#     - echo "Linting code... This will take about 10 seconds."
#     - sleep 10
#     - echo "No lint issues found. :D"

# deploy-job:      # This job runs in the deploy stage.
#   stage: deploy  # It only runs when *both* jobs in the test stage complete successfully.
#   environment: production
#   script:
#     - echo "Deploying application..."
#     - echo "Application successfully deployed."

# TODO: Remove this when CI is used again. This is just here to avoid triggering failed pipeline emails.
stages:
  - default

# An empty job to ensure the pipeline does not fail
dummy-job:
  stage: default
  script:
    - echo "This is a dummy job to ensure the pipeline does not fail"
  only:
    - schedules # Restrict this job to run only if triggered by a schedule (it won't run in normal pipelines)