-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
109 lines (101 loc) · 3.03 KB
/
.gitlab-ci.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# TODO needs
# TODO tags
# TODO Double check everything
# docker image names
# packages
# versions
stages:
- .pre
- build
- deploy
variables:
PROJECT_NAME: s3d-cgal
# TODO This is valid only for the ubuntu build
DOCKER_IMAGE_NAME: s3d-cgal-ubuntu
# Always clone a fresh repo
GIT_STRATEGY: clone
# Clone submodules recursively
GIT_SUBMODULE_STRATEGY: recursive
# Get only the last commit
GIT_DEPTH: 1
# Don't create a pipeline for every push
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
when: never
- when: always
windows:start-runner:
image: ubuntu:latest
stage: .pre
before_script:
- apt-get update
- apt-get install curl jq unzip -y
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- unzip -q awscliv2.zip
- ./aws/install
- rm -rf ./aws/* awscliv2.zip
script:
- aws --version
- INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=Gitlab Runner Windows" | jq '.Reservations[0].Instances[0].InstanceId')
- INSTANCE_ID=${INSTANCE_ID//\"}
- "echo INSTANCE_ID: ${INSTANCE_ID}"
- aws ec2 start-instances --instance-id $INSTANCE_ID
- aws ec2 wait instance-running --instance-ids $INSTANCE_ID
- aws ec2 wait instance-status-ok --instance-ids $INSTANCE_ID
needs: []
windows:build:
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/s3d-base-windows
stage: build
script:
- "& \"${env:S3D_SOURCES_DIR}/wrap-bash.bat\" ./s3d_build_cgal.sh"
- "Copy-Item -Path \"${env:S3D_INSTALL_DIR}/cgal\" -Destination \"${env:CI_PROJECT_DIR}/install\" -Recurse -Container -Verbose"
tags:
- windows
needs:
- windows:start-runner
artifacts:
paths:
- "${CI_PROJECT_DIR}\\install"
windows:deploy:
image: ubuntu:latest
stage: deploy
variables:
PACKAGE_NAME: cgal
PACKAGE_VERSION: "5.1.1"
before_script:
- apt-get update
- apt-get install -y curl zip unzip jq
script:
- pwd
- ls
- cd install
- zip -r "../cgal.zip" *
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "../cgal.zip" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${PACKAGE_VERSION}/cgal.zip" -w "\n" | tee upload-result.json'
- "[ -z \"$(jq '.error // empty' -e < upload-result.json)\" ]"
needs:
- windows:build
rules:
- when: manual
ubuntu:build:
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker info
- apk add --no-cache python3 py-pip make
- pip install awscli
- $(aws ecr get-login --region us-east-1 --no-include-email)
variables:
AWS_REGISTRY_IMAGE: ${AWS_REGISTRY}/${DOCKER_IMAGE_NAME}
script:
# TODO Build a package instead of a docker image
- docker pull ${AWS_REGISTRY_IMAGE}:latest || true
- make -f ${PROJECT_NAME}.makefile ${DOCKER_IMAGE_NAME}.image
- docker image ls
- docker tag ${DOCKER_IMAGE_NAME} ${AWS_REGISTRY_IMAGE}
- docker push ${AWS_REGISTRY_IMAGE}:latest
artifacts:
when: always
untracked: true
needs: []