-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
81 lines (75 loc) · 2.12 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
81 lines (75 loc) · 2.12 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
image: docker:24.0.7-dind-alpine3.18 # Alpine 3.18's repo contains by default Python v3.11.8
stages:
- deploy
- test
variables:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost.localstack.cloud:4566
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
DEBUG: 1
LS_LOG: trace
LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT: 300
services:
- name: docker:24.0.7-dind-alpine3.18
alias: docker
command: ["--tls=false"]
default:
before_script: &default_before_scripts
- apk update
- apk add --no-cache gcc musl-dev linux-headers bash zip jq curl py3-psutil python3
- python3 -m ensurepip
- python3 -m pip install --no-cache --upgrade pip setuptools
- mkdir -p $PIP_CACHE_DIR
- python3 -m pip install localstack awscli awscli-local
- docker pull localstack/localstack-pro:latest
# Gitlab has changed to ipv6, but LocalStack does not support it
- dind_ip="$(getent ahostsv4 docker | cut -d' ' -f1 | head -n1)"
- echo -e "${dind_ip}\tlocalhost.localstack.cloud\n" >> /etc/hosts
- localstack start -d
- localstack wait -t 30
- mkdir -p /usr/lib/localstack
- (test -f ./ls-state-pod.zip && localstack state import ./ls-state-pod.zip) || true
cache:
paths:
- $CI_PROJECT_DIR/.cache/pip
artifacts:
paths:
- $CI_PROJECT_DIR/ls-state-pod.zip
expire_in: 1 days
deploy:
stage: deploy
rules:
- when: never
changes:
- ./*.md
- LICENSE
- .circleci/*
- .github/*
- when: always
script:
- ./deployment/build-lambdas.sh
- ./deployment/awslocal/deploy.sh
- mkdir -p /usr/lib/localstack
- localstack state export ls-state-pod.zip
test:
stage: test
rules:
- when: never
changes:
- ./*.md
- LICENSE
- .circleci/*
- .github/*
- when: always
needs:
- deploy
before_script:
- *default_before_scripts
- python3 -m pip install -r requirements-dev.txt
script:
- python3 -m pytest tests || (localstack logs && exit 1)