Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to verify that all commits compile using GitLab CI?

I have a project where I'd like to use GitLab CI to automate the following:

  1. Confirm that commit at the HEAD of each pushed feature branch passes the tests.
  2. Confirm that each commit within a pushed feature branch properly compiles.

So far I've solved 1 by creating a simple job called my_test_job that successfully runs my tests on every branch push using mvn verify.

How can I solve 2? The command to build the project is mvn package, but I don't know how to have this run on every commit of a pushed branch.

My current gitlab-ci.yml file:

image: maven:3.3.3-jdk-8

stages:
  - test

my_test_job:
  script: mvn verify

tl;dr - I'd like GitLab CI to confirm that each commit within a pushed feature branch compiles without error.

Thanks!

like image 416
disposableme Avatar asked Oct 19 '25 04:10

disposableme


1 Answers

Unfortunately, Gitlab currently cannot be configured to automatically build all commits: https://gitlab.com/gitlab-org/gitlab-ce/issues/14792

like image 193
Martin Avatar answered Oct 21 '25 23:10

Martin