|
| 1 | +This note describes the setup of our GitHub/GitLab integration. The main |
| 2 | +AMReX repo is hosted at https://github.com/AMReX-Codes/amrex, with a mirror |
| 3 | +at https://gitlab.spack.io/amrex/amrex. The GitLab mirror runs CI tests on |
| 4 | +runners hosted at |
| 5 | +https://systems.nic.uoregon.edu/internal-wiki/index.php?title=Category:Servers. We |
| 6 | +run three types of tests: nightly tests using the development branch, tests |
| 7 | +triggerd when new commits are pushed to the GitLab mirror (either through |
| 8 | +GitLab's regular pulling of the latest development branch from GitHub or by |
| 9 | +the developers directly), and tests triggered by a special comment from |
| 10 | +maintainers. |
| 11 | + |
| 12 | +Instructions for creating a pull mirror can be found at |
| 13 | +https://docs.gitlab.com/user/project/repository/mirror/pull/. You can choose |
| 14 | +to pull selected branches or all branches. For AMReX, this choice does not |
| 15 | +matter since we only have one active branch. However, for repoositories with |
| 16 | +many active branches, pulling all branches may trigger CI jobs on every |
| 17 | +activity. |
| 18 | + |
| 19 | +Instructions for creating schedules pipelines can be found at |
| 20 | +https://docs.gitlab.com/ci/pipelines/schedules/. By default, GitLab uses |
| 21 | +`.gitlab-ci.yml` at the repository root for pipeline configurations, but |
| 22 | +this can be changed. AMReX's GitLab CI file is in the `.gitlab` |
| 23 | +directory. To change the configuration file location, select `Settings -> |
| 24 | +CI/CD -> General pipelines` and update `CI/CD configuration file`. |
| 25 | + |
| 26 | +CI/CD jobs triggered by push require no special setup. They can also be |
| 27 | +disabled. |
| 28 | + |
| 29 | +For GitHub PR triggered jobs, we choose not to run automatically. Instead |
| 30 | +they need to be triggered by a `/run-hpsf-gitlab-ci` comment from authorized |
| 31 | +maintainers, which starts the `run-hpsf-gitlab-ci` workflow defined in |
| 32 | +`.github/workflows/trigger-hpsf-gitlab-ci.yml`. This workflow uses GitLab's |
| 33 | +REST API to start a pipeline job on GitLab. The PR comment triggered |
| 34 | +pipeline job uses the same configuration file shared with the scheduled |
| 35 | +pipeline: `.gitlab/hpsf-gitlab-ci.yml`. The PR comment triggered job pulls |
| 36 | +the PR branch from GitHub first before running tests. For this approach to |
| 37 | +work, we store a pipeline trigger (obtained from GitLab's `Settings -> CI/CD |
| 38 | +-> Pipeline trigger tokens`) as a secret at GitHub's `Settings -> Secrets |
| 39 | +and variables -> Actions -> Repository secrets`. The GitHub workflow waits |
| 40 | +for the result of the GitLab pipeline result and posts the final status and |
| 41 | +a link to the result as a comment. |
0 commit comments