tricoteuses-legifrance/.gitlab-ci.yml

90 lines
2.2 KiB
YAML
Raw Normal View History

2022-11-15 15:31:20 +01:00
default:
image: node:lts
cache:
paths:
- node_modules/
variables:
2022-11-15 15:44:38 +01:00
DATASET:
description: "Dataset to import (either dole, jorf, kali or legi"
value: dole
2022-11-15 15:31:20 +01:00
## Ensure that all the Git tags are retrieved.
## https://docs.gitlab.com/ee/user/project/pipelines/settings.html#git-shallow-clone
GIT_DEPTH: 0
## Needed for storing locale dates
TZ: Europe/Paris
stages:
- build
2022-11-15 15:36:42 +01:00
# - test
2022-11-15 15:31:20 +01:00
- download
build:
stage: build
except:
- schedules
- web
2022-11-15 15:31:20 +01:00
before_script:
- npm ci
script:
2022-11-15 15:34:48 +01:00
- rm -f .env
- ln -s example.env .env
2022-11-15 15:31:20 +01:00
- npm run build
2022-11-15 15:36:42 +01:00
# test:
# stage: test
# except:
# - schedules
# - web
2022-11-15 15:36:42 +01:00
# before_script:
# - npm ci
# script:
# - rm -f .env
# - ln -s example.env .env
# - npm run test
2022-11-15 15:31:20 +01:00
download:
2022-11-15 15:37:56 +01:00
stage: download
2022-11-15 15:31:20 +01:00
only:
- schedules
- web
before_script:
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
- "which ssh-agent || ( apt update -y && apt install openssh-client -y )"
## Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
## Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
## Accept the SSH host keys of git.en-root.org.
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
## Set the Git user name and email.
- git config --global user.email "tricoteuses@tricoteuses.fr"
- git config --global user.name "Tricoteuses données Dila"
- npm ci
script:
2022-11-15 15:34:48 +01:00
- rm -f .env
- ln -s example.env .env
2022-11-15 16:05:44 +01:00
- rm -Rf dila-data/
- mkdir dila-data/
- git clone git@git.en-root.org:tricoteuses/data/dila/${DATASET}.git dila-data/${DATASET}
- npx tsx src/scripts/download_dila_dataset.ts ${DATASET} dila-data/ --push
timeout: 6 hours