Skip to content

Commit 57db965

Browse files
committed
Add typing job
Signed-off-by: Federico Busetti <729029+febus982@users.noreply.github.com>
1 parent e12acb8 commit 57db965

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

.gitlab_ci/_templates.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
variables:
2+
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE
3+
DOCKER_IMAGE_TAG: $CI_COMMIT_SHA
4+
DOCKER_IMAGE_TAG_PREFIX: ""
5+
DOCKER_IMAGE_FULL_TAG: $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG_PREFIX$DOCKER_IMAGE_TAG
6+
17
# Build Docker image for test
28
# TODO: Sign image using Cosign
39
.build-and-push-gitlab:
@@ -6,9 +12,6 @@
612
- docker:24.0.2-dind
713
variables:
814
DOCKER_BUILDKIT: 1
9-
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE
10-
DOCKER_IMAGE_TAG: $CI_COMMIT_SHA
11-
DOCKER_IMAGE_TAG_PREFIX: ""
1215
DOCKER_PLATFORM: "linux/arm64,linux/amd64"
1316
DOCKER_TARGET: dev
1417
before_script:
@@ -17,12 +20,18 @@
1720
- docker buildx create --use
1821
- docker buildx inspect --bootstrap
1922
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
20-
- echo "Building $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG_PREFIX$DOCKER_IMAGE_TAG - Cache from $DOCKER_IMAGE_NAME:cache"
23+
- echo "Building $DOCKER_IMAGE_FULL_TAG - Cache from $DOCKER_IMAGE_NAME:cache"
2124
- |
2225
docker buildx build --push \
2326
--target $DOCKER_TARGET \
24-
--tag $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG_PREFIX$DOCKER_IMAGE_TAG \
27+
--tag $DOCKER_IMAGE_FULL_TAG \
2528
--platform $DOCKER_PLATFORM \
2629
--cache-from type=registry,ref=$DOCKER_IMAGE_NAME:cache \
2730
--cache-to type=registry,ref=$DOCKER_IMAGE_NAME:cache \
2831
.
32+
33+
.python-typing:
34+
image: $DOCKER_IMAGE_FULL_TAG
35+
script:
36+
- make typing
37+

.gitlab_ci/test.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Test Docker image
2-
test:
2+
typing:
33
stage: test
4-
image: docker:24.0.2
5-
services:
6-
- docker:24.0.2-dind
7-
before_script:
8-
- apk add --no-cache bash
9-
script:
10-
- docker run --rm $TEST_TAG make ci-test
4+
variables:
5+
DOCKER_IMAGE_TAG_PREFIX: "test-"
6+
rules:
7+
# We run the pipeline only on merge requests or the `main` branch
8+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
9+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
10+
extends:
11+
- .python-typing

0 commit comments

Comments
 (0)