diff options
author | David Timber <dxdt@dev.snart.me> | 2024-11-14 06:19:59 +0100 |
---|---|---|
committer | David Timber <dxdt@dev.snart.me> | 2024-11-14 08:24:24 +0100 |
commit | 82891a7b9fcc2d5d7670c071859112f277ad8c6a (patch) | |
tree | a3bb43d4e52e4f24eaacfeb1bc25c274cd1c7a12 | |
parent | dd3fc0ca3da1512cff3c985aedae0f9438d39544 (diff) |
Add Gitlab CI ...
- Fix incorrect python shebang for Alpine runners
- Reduce required Python version to 3.0
-rw-r--r-- | .gitlab-ci.yml | 39 | ||||
-rw-r--r-- | common/__init__.py | 9 | ||||
-rwxr-xr-x | make-avg | 2 | ||||
-rwxr-xr-x | make-place | 2 | ||||
-rwxr-xr-x | make-readme | 2 | ||||
-rwxr-xr-x | make-table | 2 |
6 files changed, 47 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..c560737e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +image: docker:stable + +workflow: + rules: + - if: $CI_COMMIT_BRANCH == "gitlab" + +stages: + - main + +main-job: + stage: main + before_script: + - apk update && apk add git jq make curl python3 bash openssh-client + + - git config user.email "_@users.noreply.gitlab.com" + - git config user.name "Snapshot Automation Bot" + - git remote add cdci_origin git@gitlab.com:$CI_PROJECT_PATH.git + + - eval `ssh-agent -s` + - echo "${SSH_PRIVATE_KEY_TOOLKIT}" | tr -d '\r' | ssh-add - > /dev/null + - echo "${SSH_PRIVATE_KEY_MIRROR}" | tr -d '\r' | ssh-add - > /dev/null + + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - touch ~/.ssh/config + - echo -e "Host gitlab.com\n\tStrictHostKeyChecking no" >> ~/.ssh/config + - echo "$SSH_KNOWN_HOSTS_MIRROR" >> ~/.ssh/known_hosts + - chmod 600 ~/.ssh/config ~/.ssh/known_hosts + script: + - git checkout gitlab + + - make clean + - make + + - git add --all + - git commit -sm 'Data snapshot commit' + - git push cdci_origin gitlab + + - ssh -T cdci@embla.dev.snart.me diff --git a/common/__init__.py b/common/__init__.py index 5770ec96..41f1329a 100644 --- a/common/__init__.py +++ b/common/__init__.py @@ -1,7 +1,6 @@ import math -from typing import Any, Callable -def load_data_from_file (path: str, mask_noent = True) -> dict[str, float]: +def load_data_from_file (path: str, mask_noent = True): try: with open(path) as f: return load_data(f.readline) @@ -9,10 +8,10 @@ def load_data_from_file (path: str, mask_noent = True) -> dict[str, float]: if not mask_noent: raise e - return dict[str, float]() + return dict() -def load_data (read_f: Callable) -> dict[str, float]: - ret = dict[str, float]() +def load_data (read_f): + ret = dict() while True: l = read_f() @@ -1,4 +1,4 @@ -#!/bin/env python3 +#!/usr/bin/env python3 import sys import common @@ -1,4 +1,4 @@ -#!/bin/env python3 +#!/usr/bin/env python3 import sys import common diff --git a/make-readme b/make-readme index 90b95b6f..5d42b0df 100755 --- a/make-readme +++ b/make-readme @@ -1,4 +1,4 @@ -#!/bin/env python3 +#!/usr/bin/env python3 import datetime import sys @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/env python3 import sys import common |