First I prepare deployed Apex and Apex which tests that. The Apex code are shown as below.
CI in gitlab comes to move by putting .gitlab-ci.yml in the route of a repository of gitlab. The example is shown as below.
When you execute
git push, this process is carried out.
The summary of the process written in .gitlab-ci.yml is as follows.
in before_script section
- install force-dev-tool
- login production organization ( using access information written in
- remove directories exclude
force-app/main/default/directory ( this directory structure is the standard structure with using VSCode's Salesforce Extension Pack ).
force-app/main/default/package.xmlto deploy modules which are ApexClass, ApexComponent, ApexPage, ApexTrigger, StaticResource and AuraDefinitionBundle.
in test_deploy_production section
force-dev-tool deployas test only mode.
in deploy_production section
force-dev-tool deployas deploy to production environment.
The example of
config/.orgs.json is shown as below.