forked from iterative/cml
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (69 loc) · 2.39 KB
/
gitlab.yml
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
66
67
68
69
name: GitLab
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
services:
gitlab:
image: docker://gitlab/gitlab-ce
ports: ['8000:8000']
env:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://localhost:8000/gitlab'
nginx['custom_nginx_config'] = '
server {
listen 8000;
location /gitlab {
proxy_set_header Host $http_host;
proxy_pass http://gitlab-workhorse;
}
}
'
steps:
- uses: actions/checkout@v3
- name: Configure credentials
run: |
docker exec ${{ job.services.gitlab.id }} bin/gitlab-rails runner "
; user = User.find_by_username('root')
; user.password = '${{ github.token }}'
; user.password_confirmation = '${{ github.token }}'
; user.save!
; token = user.personal_access_tokens.create(scopes: [:api], name: 'Token')
; token.set_token('${{ github.token }}')
; token.save!
"
- name: Create test project
run: |
curl "http://localhost:8000/gitlab/api/v4/projects" \
--header "PRIVATE-TOKEN: ${{ github.token }}" \
--request POST \
--get \
--data "name=test"
- name: Create test commit
run: |
curl "http://localhost:8000/gitlab/api/v4/projects/root%2Ftest/repository/files/README.md" \
--header "PRIVATE-TOKEN: ${{ github.token }}" \
--request POST \
--get \
--data "author_email=test@test" \
--data "author_name=Test" \
--data "branch=main" \
--data "commit_message=Create%20README.md" \
--data "content=Test"
- name: Get last commit
id: commit
run: |
curl "http://localhost:8000/gitlab/api/v4/projects/root%2Ftest/repository/commits/main" \
--header "PRIVATE-TOKEN: ${{ github.token }}" \
--request GET \
| jq -r .id \
| xargs -0 printf "hash=%s" >> $GITHUB_OUTPUT
- run: npm ci
- name: Run cml-send-comment
run: |
node bin/cml.js send-comment \
--token=${{ github.token }} \
--repo=http://localhost:8000/gitlab/root/test \
--commit-sha=${{ steps.commit.outputs.hash }} \
--driver=gitlab \
<(echo message)