-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
65 lines (50 loc) · 1.86 KB
/
.gitlab-ci.yml
File metadata and controls
65 lines (50 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
stages:
- mirror
- tests
- pages
- download_dependencies
- build_sources
- build_and_publish_docker_image
- release
variables:
GITHUB_MIRROR_REPO: davidebianchi03/codebox
default:
after_script:
# push the status of the pipeline of github
# if this is the last job of the pipeline
- |
if [ -z $CI_COMMIT_TAG ]; then
if [ $CI_COMMIT_BRANCH = $CI_DEFAULT_BRANCH ]; then
if [ $CI_JOB_STATUS = "success" ] || [ $CI_JOB_STATUS = "failed" ]; then
gh_job_status=pending
if [ $CI_JOB_STATUS = "success" ]; then gh_job_status=success; fi
if [ $CI_JOB_STATUS = "failed" ]; then gh_job_status=failure; fi
echo "pipeline status: $gh_job_status"
response=$(curl -s -w "\n%{http_code}" -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$GITHUB_MIRROR_REPO/statuses/$CI_COMMIT_SHA \
-d "{
\"state\": \"$gh_job_status\",
\"context\": \"GitLab CI\",
\"target_url\": \"$CI_PIPELINE_URL\"
}")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | head -n -1)
echo "Github status code: $http_code"
if [ "$http_code" -ne 201 ]; then
echo "GitHub API request failed with HTTP code $http_code"
echo $http_code
exit 1
fi
fi
fi
fi
include:
- local: .gitlab/ci/github_mirror.yml
- local: .gitlab/ci/unit_tests.yml
- local: .gitlab/ci/pages.yml
- local: .gitlab/ci/download_cli.yml
- local: .gitlab/ci/retrieve_recommended_runner_version.yml
- local: .gitlab/ci/build_sources.yml
- local: .gitlab/ci/build_and_publish_docker_image.yml
- local: .gitlab/ci/release.yml