Compare commits
94 Commits
unbalanced
...
cicd
Author | SHA1 | Date | |
---|---|---|---|
|
26c51d409f | ||
|
2c1137b590 | ||
797caf0678 | |||
ea9a4a6618 | |||
1d3c968ad9 | |||
fdaff717b0 | |||
bbdf05f4ce | |||
845f52ae33 | |||
4bab4c1b8a | |||
fba937b0d9 | |||
|
a28fea0cc7 | ||
|
e31f02cd38 | ||
|
123733def0 | ||
b24aa4bb54 | |||
|
226a3a3856 | ||
|
6ec4d836cc | ||
8fe596ecaa | |||
2c5b05f01a | |||
bdf91e0957 | |||
4b012e64c4 | |||
528c25e11a | |||
82385d1164 | |||
f8fa02924c | |||
dee4a9c037 | |||
|
530e2763d9 | ||
|
4d394dc080 | ||
|
d541628920 | ||
98878bd6b6 | |||
9ac05f338b | |||
54620edeb8 | |||
3a2e419d27 | |||
c47f7d4ae8 | |||
8b72846275 | |||
4c889c28ce | |||
5f5c28b033 | |||
78d8b60f59 | |||
f0e5056de6 | |||
85803e95f1 | |||
f83c6b7988 | |||
112b745a45 | |||
d665e1f12e | |||
1e341a353a | |||
4c5d5867c7 | |||
|
06f0f40964 | ||
|
5940937f6e | ||
5916053780 | |||
ef9b330685 | |||
|
fc377e3a44 | ||
|
2b1714ed9b | ||
ac38241629 | |||
8c446eeb4b | |||
6d0a52a5df | |||
798f6de969 | |||
afb0e16596 | |||
ce3ffa7e6a | |||
ff65f260d0 | |||
a7c5db924d | |||
16abe31b34 | |||
6cae40e2e8 | |||
d32e075d3d | |||
bd71602b0a | |||
774b52e3e8 | |||
b349fe729a | |||
67f2a9f474 | |||
69ec0da893 | |||
116aae9465 | |||
|
5c4b1e769c | ||
|
3487e5da0b | ||
|
ed57c7ec28 | ||
659237211d | |||
933fb8d435 | |||
910c6bcf2d | |||
7a3ea5ad67 | |||
e815627197 | |||
d234291a5c | |||
f4a46241cd | |||
6cd74ba294 | |||
b5aeabc813 | |||
c1a221bd8a | |||
429acc65c2 | |||
277a153a90 | |||
444efdb279 | |||
70fbe935b6 | |||
|
0f093d4359 | ||
|
84b696b411 | ||
16ae62c21b | |||
a5f83748d6 | |||
6bb20f6d2d | |||
2d0e5429df | |||
3977fc4c13 | |||
4b5ae81dae | |||
03cce7edee | |||
9941fa7bac | |||
|
5d4770dfe1 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,3 +5,6 @@
|
||||
# Ignore python stuff
|
||||
**/__pycache__
|
||||
**/.pytest_cache
|
||||
|
||||
# Ignore les fichiers système de MacOS
|
||||
**/.DS_Store
|
@@ -1,6 +1,5 @@
|
||||
include:
|
||||
- .gitlab/valid_set.yml
|
||||
- .gitlab/missing_tag_set.yml
|
||||
- .gitlab/*.yml
|
||||
|
||||
stages:
|
||||
- Manifest
|
||||
@@ -10,7 +9,7 @@ stages:
|
||||
- Release
|
||||
|
||||
variables:
|
||||
ENTRY_FOLDER: $CI_PROJECT_DIR/test # test directory for testing CI/CD, or assets directory for normal operations
|
||||
ENTRY_FOLDER: test # test directory for testing CI/CD, or assets directory for normal operations
|
||||
RELEASE_VERSION: v0.$CI_PIPELINE_IID
|
||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${RELEASE_VERSION}"
|
||||
|
||||
@@ -19,16 +18,16 @@ variables:
|
||||
stage: Manifest
|
||||
image: node:latest
|
||||
rules:
|
||||
#- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
- changes:
|
||||
- ${ENTRY_FOLDER}/${PACKAGE_NAME}/*
|
||||
script:
|
||||
- cd src/
|
||||
- npm install
|
||||
- npm run start
|
||||
- cat ${ENTRY_FOLDER}/${PACKAGE_NAME}/theme.json
|
||||
- cat ../${ENTRY_FOLDER}/${PACKAGE_NAME}/theme.json
|
||||
- npm run test
|
||||
artifacts:
|
||||
paths:
|
||||
@@ -40,7 +39,7 @@ variables:
|
||||
stage: Test
|
||||
image: python:latest
|
||||
rules:
|
||||
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
#- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
changes:
|
||||
- ${ENTRY_FOLDER}/${PACKAGE_NAME}/*
|
||||
@@ -54,17 +53,17 @@ variables:
|
||||
stage: Bundle
|
||||
image: javieraviles/zip:latest
|
||||
rules:
|
||||
#- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
changes:
|
||||
- ${ENTRY_FOLDER}/${PACKAGE_NAME}/*
|
||||
script:
|
||||
- zip -j ${PACKAGE_NAME}.zip ${ENTRY_FOLDER}/${PACKAGE_NAME}/*
|
||||
- zip -j ${PACKAGE_NAME}.wdd ${ENTRY_FOLDER}/${PACKAGE_NAME}/*
|
||||
artifacts:
|
||||
paths:
|
||||
- ${PACKAGE_NAME}.zip
|
||||
- ${PACKAGE_NAME}.ddw
|
||||
when: on_success
|
||||
expire_in: "1 hour"
|
||||
|
||||
@@ -72,6 +71,7 @@ variables:
|
||||
stage: Distribute
|
||||
image: curlimages/curl:latest
|
||||
rules:
|
||||
#- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
@@ -81,12 +81,13 @@ variables:
|
||||
- |
|
||||
curl --fail \
|
||||
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
|
||||
--upload-file ${PACKAGE_NAME}.zip "${PACKAGE_REGISTRY_URL}/${PACKAGE_NAME}.zip?select=package_file"
|
||||
--upload-file ${PACKAGE_NAME}.ddw "${PACKAGE_REGISTRY_URL}/${PACKAGE_NAME}.ddw?select=package_file"
|
||||
|
||||
.release-job:
|
||||
stage: Release
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
rules:
|
||||
#- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "cicd"
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
@@ -95,11 +96,12 @@ variables:
|
||||
script:
|
||||
- echo "Releasing assets for $PACKAGE_NAME"
|
||||
release:
|
||||
name: "Release $PACKAGE_NAME $RELEASE_VERSION"
|
||||
name: "Livrable $PACKAGE_NAME $RELEASE_VERSION"
|
||||
tag_name: "$PACKAGE_NAME.$RELEASE_VERSION"
|
||||
description: "Version $RELEASE_VERSION"
|
||||
ref: "$CI_COMMIT_SHA"
|
||||
assets:
|
||||
links:
|
||||
- name: ${PACKAGE_NAME}
|
||||
url: "${PACKAGE_REGISTRY_URL}/${PACKAGE_NAME}.zip"
|
||||
- name: ${PACKAGE_NAME}.ddw
|
||||
url: "${PACKAGE_REGISTRY_URL}/${PACKAGE_NAME}.ddw"
|
||||
link_type: package
|
32
.gitlab/existing_valid_theme_set.yml
Normal file
32
.gitlab/existing_valid_theme_set.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
manifest-job/existing_valid_theme_set:
|
||||
variables:
|
||||
PACKAGE_NAME: "existing_valid_theme_set"
|
||||
extends: .manifest-job
|
||||
|
||||
test-images-job/existing_valid_theme_set:
|
||||
needs:
|
||||
- manifest-job/existing_valid_theme_set
|
||||
variables:
|
||||
PACKAGE_NAME: "existing_valid_theme_set"
|
||||
extends: .test-job
|
||||
|
||||
bundle-job/existing_valid_theme_set:
|
||||
needs:
|
||||
- manifest-job/existing_valid_theme_set
|
||||
variables:
|
||||
PACKAGE_NAME: "existing_valid_theme_set"
|
||||
extends: .bundle-job
|
||||
|
||||
upload-job/existing_valid_theme_set:
|
||||
needs:
|
||||
- bundle-job/existing_valid_theme_set
|
||||
variables:
|
||||
PACKAGE_NAME: "existing_valid_theme_set"
|
||||
extends: .upload-job
|
||||
|
||||
release-job/existing_valid_theme_set:
|
||||
needs:
|
||||
- upload-job/existing_valid_theme_set
|
||||
variables:
|
||||
PACKAGE_NAME: "existing_valid_theme_set"
|
||||
extends: .release-job
|
32
.gitlab/unbalanced_set.yml
Normal file
32
.gitlab/unbalanced_set.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
manifest-job/unbalanced_set:
|
||||
variables:
|
||||
PACKAGE_NAME: "unbalanced_set"
|
||||
extends: .manifest-job
|
||||
|
||||
test-images-job/unbalanced_set:
|
||||
needs:
|
||||
- manifest-job/unbalanced_set
|
||||
variables:
|
||||
PACKAGE_NAME: "unbalanced_set"
|
||||
extends: .test-job
|
||||
|
||||
bundle-job/unbalanced_set:
|
||||
needs:
|
||||
- manifest-job/unbalanced_set
|
||||
variables:
|
||||
PACKAGE_NAME: "unbalanced_set"
|
||||
extends: .bundle-job
|
||||
|
||||
upload-job/unbalanced_set:
|
||||
needs:
|
||||
- bundle-job/unbalanced_set
|
||||
variables:
|
||||
PACKAGE_NAME: "unbalanced_set"
|
||||
extends: .upload-job
|
||||
|
||||
release-job/unbalanced_set:
|
||||
needs:
|
||||
- upload-job/unbalanced_set
|
||||
variables:
|
||||
PACKAGE_NAME: "unbalanced_set"
|
||||
extends: .release-job
|
67
.vscode/launch.json
vendored
67
.vscode/launch.json
vendored
@@ -12,7 +12,8 @@
|
||||
"start"
|
||||
],
|
||||
"env": {
|
||||
"ENTRY_FOLDER": "${workspaceFolder}/test",
|
||||
"CI_PROJECT_DIR": "${workspaceFolder}",
|
||||
"ENTRY_FOLDER": "test",
|
||||
"PACKAGE_NAME": "valid_set"
|
||||
},
|
||||
"skipFiles": [
|
||||
@@ -30,7 +31,8 @@
|
||||
"test"
|
||||
],
|
||||
"env": {
|
||||
"ENTRY_FOLDER": "${workspaceFolder}/test",
|
||||
"CI_PROJECT_DIR": "${workspaceFolder}",
|
||||
"ENTRY_FOLDER": "test",
|
||||
"PACKAGE_NAME": "valid_set"
|
||||
},
|
||||
"skipFiles": [
|
||||
@@ -51,10 +53,69 @@
|
||||
"--color=yes"
|
||||
],
|
||||
"env": {
|
||||
"ENTRY_FOLDER": "${workspaceFolder}/test",
|
||||
"CI_PROJECT_DIR": "${workspaceFolder}",
|
||||
"ENTRY_FOLDER": "test",
|
||||
"PACKAGE_NAME": "valid_set"
|
||||
},
|
||||
"justMyCode": true
|
||||
},
|
||||
{
|
||||
"name": "Gen-Manifest existing_valid_theme_set",
|
||||
"cwd": "${workspaceFolder}/src",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": [
|
||||
"run",
|
||||
"start"
|
||||
],
|
||||
"env": {
|
||||
"CI_PROJECT_DIR": "${workspaceFolder}",
|
||||
"ENTRY_FOLDER": "test",
|
||||
"PACKAGE_NAME": "existing_valid_theme_set"
|
||||
},
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Test-Manifest existing_valid_theme_set",
|
||||
"cwd": "${workspaceFolder}/src",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": [
|
||||
"run",
|
||||
"test"
|
||||
],
|
||||
"env": {
|
||||
"CI_PROJECT_DIR": "${workspaceFolder}",
|
||||
"ENTRY_FOLDER": "test",
|
||||
"PACKAGE_NAME": "existing_valid_theme_set"
|
||||
},
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Test-Images existing_valid_theme_set",
|
||||
"cwd": "${workspaceFolder}/src",
|
||||
"console": "internalConsole",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "pytest",
|
||||
"args": [
|
||||
"test_images.py",
|
||||
"-rA",
|
||||
"--tb=line",
|
||||
"--color=yes"
|
||||
],
|
||||
"env": {
|
||||
"CI_PROJECT_DIR": "${workspaceFolder}",
|
||||
"ENTRY_FOLDER": "test",
|
||||
"PACKAGE_NAME": "existing_valid_theme_set"
|
||||
},
|
||||
"justMyCode": true
|
||||
},
|
||||
]
|
||||
}
|
@@ -1,18 +1,24 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const iptc = require("node-iptc");
|
||||
const { exit } = require("process");
|
||||
|
||||
|
||||
// find all images
|
||||
const slug = process.env["PACKAGE_NAME"];
|
||||
// Fetch envs to target the right folder
|
||||
const workDir = process.env["CI_PROJECT_DIR"];
|
||||
const root = process.env["ENTRY_FOLDER"];
|
||||
let workingDirectory = path.join(root, slug);
|
||||
const slug = process.env["PACKAGE_NAME"];
|
||||
if (!workDir || !slug || !root) exit(1);
|
||||
let workingDirectory = path.join(workDir, root, slug);
|
||||
|
||||
// extract metadata from them
|
||||
fs.readdir(workingDirectory, (err, files) => {
|
||||
if (err) { throw err };
|
||||
if (err) { throw err }; // If IO error, exit with an error message
|
||||
|
||||
// construct a JSON file
|
||||
// If there is already a theme.json silentely exit and let mocha running afterwards
|
||||
if (files.find(file => path.extname(file) == '.json')) exit(0);
|
||||
|
||||
// construct a JSON object
|
||||
let theme = new Object();
|
||||
theme.dayImageList = [];
|
||||
theme.nightImageList = [];
|
||||
@@ -63,7 +69,7 @@ fs.readdir(workingDirectory, (err, files) => {
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// make it the theme.json
|
||||
fs.writeFileSync(path.join(workingDirectory, 'theme.json'), JSON.stringify(theme));
|
||||
});
|
||||
|
||||
|
@@ -33,11 +33,13 @@ function flatReferences(manifest) {
|
||||
|
||||
describe('Mandatory Checks', function () {
|
||||
before(function () {
|
||||
const workDir = process.env["CI_PROJECT_DIR"];
|
||||
expect(workDir).to.be.a("string").that.is.not.empty;
|
||||
const slug = process.env["PACKAGE_NAME"];
|
||||
expect(slug).to.be.a("string").that.is.not.empty;
|
||||
const root = process.env["ENTRY_FOLDER"];
|
||||
expect(root).to.be.a("string").that.is.not.empty;
|
||||
workingDirectory = path.join(root, slug);
|
||||
workingDirectory = path.join(workDir, root, slug);
|
||||
files = fs.readdirSync(workingDirectory);
|
||||
expect(files).to.be.an('array').that.is.not.empty;
|
||||
validator = ajv.compile(JSON.parse(fs.readFileSync(themeSchemaFile, 'utf8')));
|
||||
|
@@ -7,7 +7,7 @@ import os
|
||||
import pytest
|
||||
|
||||
|
||||
def validate_brightness_image(working_path, theme_config, high_light, image_list, brightness_way):
|
||||
def _validate_brightness_image(working_path, theme_config, high_light, image_list, brightness_way):
|
||||
image_pattern = theme_config.get("imageFilename")
|
||||
image_filenames = {}.fromkeys(glob.glob(str(Path(working_path, image_pattern))))
|
||||
# generate an image statistics for each images
|
||||
@@ -15,6 +15,7 @@ def validate_brightness_image(working_path, theme_config, high_light, image_list
|
||||
this_image = Image.open(an_imagefile).convert("L")
|
||||
this_image_stats = ImageStat.Stat(this_image)
|
||||
image_filenames[an_imagefile] = this_image_stats.mean[0]
|
||||
#print(f'{an_imagefile} : {image_filenames[an_imagefile]}')
|
||||
|
||||
# get the brightest observed image from the list
|
||||
if high_light == "dayHighlight":
|
||||
@@ -39,9 +40,10 @@ def validate_brightness_image(working_path, theme_config, high_light, image_list
|
||||
@pytest.fixture
|
||||
def working_path():
|
||||
# get the global variables containing gitlab-given project slug.
|
||||
work_directory = os.environ["CI_PROJECT_DIR"]
|
||||
entry_folder = os.environ["ENTRY_FOLDER"]
|
||||
project_slug = os.environ["PACKAGE_NAME"]
|
||||
root_folder = os.environ["ENTRY_FOLDER"]
|
||||
working_path = Path(root_folder, project_slug)
|
||||
working_path = Path(work_directory, entry_folder, project_slug)
|
||||
if not working_path.is_dir():
|
||||
raise FileNotFoundError(f"No project found for the given {working_path}.")
|
||||
return working_path
|
||||
@@ -54,11 +56,11 @@ def manifest(working_path):
|
||||
|
||||
|
||||
def test_brightest_image(working_path, manifest):
|
||||
validate_brightness_image(working_path, manifest, "dayHighlight", "dayImageList", "Brightest")
|
||||
_validate_brightness_image(working_path, manifest, "dayHighlight", "dayImageList", "Brightest")
|
||||
|
||||
|
||||
def test_darkest_image(working_path, manifest):
|
||||
validate_brightness_image(working_path, manifest, "nightHighlight", "nightImageList", "Darkest")
|
||||
_validate_brightness_image(working_path, manifest, "nightHighlight", "nightImageList", "Darkest")
|
||||
|
||||
|
||||
def test_image_size(working_path, manifest):
|
||||
|
BIN
test/existing_valid_theme_set/stray__1.jpg
Normal file
BIN
test/existing_valid_theme_set/stray__1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 346 KiB |
BIN
test/existing_valid_theme_set/stray__2.jpg
Normal file
BIN
test/existing_valid_theme_set/stray__2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 KiB |
13
test/existing_valid_theme_set/theme.json
Normal file
13
test/existing_valid_theme_set/theme.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"dayImageList": [
|
||||
1
|
||||
],
|
||||
"imageFilename": "stray__*.jpg",
|
||||
"nightImageList": [
|
||||
2
|
||||
],
|
||||
"imageCredits": "©Thoscellen, ©BlueTwelve",
|
||||
"sunriseImageList": [],
|
||||
"displayName": "Stray",
|
||||
"sunsetImageList": []
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"imageFilename": "bl3_landscape_*.jpg",
|
||||
"displayName": "BL3",
|
||||
"imageCredits": "© Gearbox",
|
||||
"displayName": "",
|
||||
"dayImageList": [
|
||||
2
|
||||
],
|
||||
|
BIN
test/unbalanced_set/unbalanced_set_1.jpg
Normal file
BIN
test/unbalanced_set/unbalanced_set_1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
BIN
test/unbalanced_set/unbalanced_set_2.jpg
Normal file
BIN
test/unbalanced_set/unbalanced_set_2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 KiB |
BIN
test/unbalanced_set/unbalanced_set_3.jpg
Normal file
BIN
test/unbalanced_set/unbalanced_set_3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 158 KiB |
Reference in New Issue
Block a user