Skip to content

Commit

Permalink
automataCI: upgraded from npm to libraries packaging
Browse files Browse the repository at this point in the history
Since npm is a library itself, we can proceed to create a
libraries CI tasks instead of serving specifically for NPM. That
way, other technologies' libraries can share the same production
processes for maximum consistencies. Hence, let's do this.

This patch upgrades from npm to libraries packaging in automataCI/
directory.

Co-authored-by: Shuralyov, Jean <[email protected]>
Co-authored-by: Galyna, Cory <[email protected]>
Co-authored-by: (Holloway) Chew, Kean Ho <[email protected]>
Signed-off-by: (Holloway) Chew, Kean Ho <[email protected]>
  • Loading branch information
3 people committed Jun 9, 2024
1 parent 9c72753 commit ed052e1
Show file tree
Hide file tree
Showing 29 changed files with 1,081 additions and 461 deletions.
27 changes: 27 additions & 0 deletions CONFIG.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,33 @@ PROJECT_SOURCE_GIT_REMOTE = 'origin'
PROJECT_SOURCE_RELEASE_TAG_LATEST = 'latest'


# PROJECT_README
# The relative location of the project readme file from $PROJECT_PATH_ROOT
# (repository root directory).
#
# Default is 'README.md'
PROJECT_README = 'README.md'


# PROJECT_LICENSE_FILE
# The relative location of the project license file from $PROJECT_PATH_ROOT
# (repository root directory).
#
# Default is 'LICENSE.txt'
PROJECT_LICENSE_FILE = 'LICENSE.txt'


# PROJECT_LICENSE_ACCEPTANCE_REQUIRED
# The flag to indicate the license of the project **MUST** be explictly
# accepted. This is used in ecosystem like .NET nupkg where a special UI
# is available to interact with the end-users.
#
# Value is lowercase 'true' or 'false'.
#
# Default is 'true'
PROJECT_LICENSE_ACCEPTANCE_REQUIRED = 'true'


# AUTOMATACI_LANG
# Overrides AutomataCI to operate in 1 specific language. Otherwise, AutomataCI
# shall query the system language settings. Only accepts language code complying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi



PACKAGE_Run_NPM() {
PACKAGE_Run_LIB() {
#__line="$1"


Expand All @@ -50,7 +50,7 @@ PACKAGE_Run_NPM() {


# copy all complimentary files to the workspace
cmd="PACKAGE_Assemble_NPM_Content"
cmd="PACKAGE_Assemble_LIB_Content"
I18N_Check_Function "$cmd"
OS_Is_Command_Available "$cmd"
if [ $? -ne 0 ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) {



function PACKAGE-Run-NPM {
function PACKAGE-Run-LIB {
param (
[string]$__line
)
Expand All @@ -41,7 +41,7 @@ function PACKAGE-Run-NPM {


# copy all complimentary files to the workspace
$cmd = "PACKAGE-Assemble-NPM-Content"
$cmd = "PACKAGE-Assemble-LIB-Content"
$null = I18N-Check-Function "$cmd"
$___process = OS-Is-Command-Available "$cmd"
if ($___process -ne 0) {
Expand All @@ -50,7 +50,7 @@ function PACKAGE-Run-NPM {
}

$null = I18N-Assemble-Package
$___process = PACKAGE-Assemble-NPM-Content `
$___process = PACKAGE-Assemble-LIB-Content `
"${_target}" `
"${_dest}" `
"${_target_filename}" `
Expand Down
8 changes: 4 additions & 4 deletions automataCI/package_unix-any.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ fi
. "${LIBS_AUTOMATACI}/_package-flatpak_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-homebrew_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-ipk_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-lib_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-msi_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-npm_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-pdf_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-pypi_unix-any.sh"
. "${LIBS_AUTOMATACI}/_package-rpm_unix-any.sh"
Expand Down Expand Up @@ -253,9 +253,9 @@ ${__common}|${__log}|PACKAGE_Run_MSI
return 1
fi

__log="${__log_directory}/npm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
FS_Append_File "$__serial_control" "\
${__common}|${__log}|PACKAGE_Run_NPM
__log="${__log_directory}/lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
FS_Append_File "$__parallel_control" "\
${__common}|${__log}|PACKAGE_Run_LIB
"
if [ $? -ne 0 ]; then
return 1
Expand Down
8 changes: 4 additions & 4 deletions automataCI/package_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ function SUBROUTINE-Package {
$null = . "${env:LIBS_AUTOMATACI}\_package-flatpak_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-homebrew_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-ipk_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-lib_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-msi_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-npm_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-pdf_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-pypi_windows-any.ps1"
$null = . "${env:LIBS_AUTOMATACI}\_package-rpm_windows-any.ps1"
Expand Down Expand Up @@ -268,9 +268,9 @@ ${__common}|${__log}|PACKAGE-Run-MSI
return 1
}

$__log = "${__log_directory}\npm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__serial_control}" @"
${__common}|${__log}|PACKAGE-Run-NPM
$__log = "${__log_directory}\lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-LIB
"@
if ($___process -ne 0) {
return 1
Expand Down
64 changes: 63 additions & 1 deletion automataCI/services/compilers/rpm.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 (Holloway) Chew, Kean Ho <[email protected]>
# Copyright 2023 (Holloway) Chew, Kean Ho <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -513,3 +513,65 @@ function RPM-Is-Valid {
# report status
return 1
}




function RPM-Register {
param(
[string]$___workspace,
[string]$___source,
[string]$___target,
[string]$___is_directory
)


# validate input
if ($(STRINGS-Is-Empty "${___workspace}") -eq 0) {
return 1
}

if ($(STRINGS-Is-Empty "${___source}") -eq 0) {
return 1
}

if ($(STRINGS-Is-Empty "${___target}") -eq 0) {
return 1
}

$___process = FS-Is-Directory "${___workspace}"
if ($___process -ne 0) {
return 1
}


# execute
## write into SPEC_INSTALL
$___spec = "${___workspace}/SPEC_INSTALL"
$___dir = "$(FS-Get-Directory "${___target}")"
$___content = "`n"
if ($___dir -ne $___target) {
$___content = "${___content}`nmkdir -p %{buildroot}/${___dir}`n"
}
$___content = "${___content}`ncp -r ${___source} %{buildroot}/${___target}`n"
$___process = FS-Append-File "${___spec}" "${___content}"
if ($___process -ne 0) {
return 1
}

## write into SPEC_FILES
$___spec = "${___workspace}/SPEC_FILES"
$___content = "/${___content}"
if ($(STRINGS-Is-Empty "${___is_directory}") -ne 0) {
$___content = "${___content}/*"
}
$___content = "${___content}`n"
$___process = FS-Append-File "${___spec}" "${___content}"
if ($___process -ne 0) {
return 1
}


# report status
return 0
}
62 changes: 61 additions & 1 deletion automataCI/services/compilers/rpm.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# Copyright 2023 (Holloway) Chew, Kean Ho <[email protected]>
# Copyright 2023 (Holloway) Chew, Kean Ho <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -524,3 +524,63 @@ RPM_Is_Valid() {
# return status
return 1
}




RPM_Register() {
#___workspace="$1"
#___source="$2"
#___target="$3"
#___is_directory="$4"


# validate input
if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then
return 1
fi

if [ $(STRINGS_Is_Empty "$2") -eq 0 ]; then
return 1
fi

if [ $(STRINGS_Is_Empty "$3") -eq 0 ]; then
return 1
fi

FS_Is_Directory "$1"
if [ $? -ne 0 ]; then
return 1
fi


# execute
## write into SPEC_INSTALL
___spec="${1}/SPEC_INSTALL"
___dir="$(FS_Get_Directory "$3")"
___content="\n"
if [ "$___dir" != "$3" ]; then
___content="${___content}\nmkdir -p %{buildroot}/${___dir}\n"
fi
___content="${___content}\ncp -r ${2} %{buildroot}/${3}\n"
FS_Append_File "$___spec" "$___content"
if [ $? -ne 0 ]; then
return 1
fi

## write into SPEC_FILES
___spec="${___workspace}/SPEC_FILES"
___content="/${3}"
if [ $(STRINGS_Is_Empty "$4") -ne 0 ]; then
___content="${___content}/*\n"
fi
___content="${___content}\n"
FS_Append_File "$___spec" "$___content"
if [ $? -ne 0 ]; then
return 1
fi


# report status
return 0
}
9 changes: 1 addition & 8 deletions src/.ci/_package-archive_unix-any.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ PACKAGE_Assemble_ARCHIVE_Content() {
return 1
fi
elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then
I18N_Assemble "$_target" "$_directory"
FS_Copy_File "$_target" "$_directory"
if [ $? -ne 0 ]; then
I18N_Assemble_Failed
return 1
fi
return 10 # handled by lib packager
elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then
return 10 # handled by wasm instead
elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then
Expand Down Expand Up @@ -87,8 +82,6 @@ PACKAGE_Assemble_ARCHIVE_Content() {
return 10 # not applicable
elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then
return 10 # not applicable
elif [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then
return 10 # not applicable
else
I18N_Assemble "$_target" "$_directory"
FS_Copy_File "$_target" "$_directory"
Expand Down
9 changes: 1 addition & 8 deletions src/.ci/_package-archive_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@ function PACKAGE-Assemble-ARCHIVE-Content {
return 1
}
} elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) {
$null = I18N-Assemble "${_target}" "${_directory}"
$___process = FS-Copy-File "${_target}" "${_directory}"
if ($___process -ne 0) {
$null = I18N-Assemble-Failed
return 1
}
return 10 # handled by lib packager
} elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) {
return 10 # handled by wasm instead
} elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) {
Expand Down Expand Up @@ -88,8 +83,6 @@ function PACKAGE-Assemble-ARCHIVE-Content {
return 10 # not applicable
} elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) {
return 10 # not applicable
} elseif ($(FS-Is-Target-A-NPM "${_target}") -eq 0) {
return 10 # not applicable
} else {
$null = I18N-Assemble "${_target}" "${_directory}"
$___process = FS-Copy-File "${_target}" "${_directory}"
Expand Down
Loading

0 comments on commit ed052e1

Please sign in to comment.