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 10, 2024
1 parent a4e0b55 commit 6c5849c
Show file tree
Hide file tree
Showing 48 changed files with 1,364 additions and 545 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
2 changes: 1 addition & 1 deletion automataCI/_package-homebrew_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function PACKAGE-Run-HOMEBREW {
"{{ TARGET_SHASUM }}" `
"${__shasum}"

$___process = FS-Append-File "${_target_path}.rb" "${__line}"
$___process = FS-Append-File "${_target_path}.rb" "${__line}`n"
if ($___process -ne 0) {
$null = I18N-Update-Failed
return 1
Expand Down
80 changes: 80 additions & 0 deletions automataCI/_package-lib_unix-any.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/sh
# Copyright 2024 (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
# the License at:
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
. "${LIBS_AUTOMATACI}/services/io/os.sh"
. "${LIBS_AUTOMATACI}/services/io/fs.sh"
. "${LIBS_AUTOMATACI}/services/i18n/translations.sh"




# initialize
if [ "$PROJECT_PATH_ROOT" = "" ]; then
>&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n"
return 1
fi




PACKAGE_Run_LIB() {
#__line="$1"


# parse input
__line="$1"

_dest="${__line%%|*}"
__line="${__line#*|}"

_target="${__line%%|*}"
__line="${__line#*|}"

_target_filename="${__line%%|*}"
__line="${__line#*|}"

_target_os="${__line%%|*}"
__line="${__line#*|}"

_target_arch="${__line%%|*}"
__line="${__line#*|}"


# copy all complimentary files to the workspace
cmd="PACKAGE_Assemble_LIB_Content"
I18N_Check_Function "$cmd"
OS_Is_Command_Available "$cmd"
if [ $? -ne 0 ]; then
I18N_Check_Failed
return 1
fi

I18N_Assemble_Package
"$cmd" "$_target" "$_dest" "$_target_filename" "$_target_os" "$_target_arch"
case $? in
10)
I18N_Assemble_Skipped
return 0
;;
0)
# accepted
;;
*)
I18N_Assemble_Failed
return 1
;;
esac


# report status
return 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
. "${env:LIBS_AUTOMATACI}\services\io\os.ps1"
. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1"
. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1"

Expand All @@ -18,37 +19,54 @@
# initialize
if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) {
Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n"
exit 1
return
}




function PACKAGE-Assemble-NPM-Content {
function PACKAGE-Run-LIB {
param (
[string]$_target,
[string]$_directory,
[string]$_target_name,
[string]$_target_os,
[string]$_target_arch
[string]$__line
)


# validate project
if ($(FS-Is-Target-A-NPM "${_target}") -ne 0) {
return 10 # not applicable
}
# parse input
$__list = $__line -split "\|"
$_dest = $__list[0]
$_target = $__list[1]
$_target_filename = $__list[2]
$_target_os = $__list[3]
$_target_arch = $__list[4]


# execute
$__dest = "${_directory}\lib${env:PROJECT_SKU}-npm_${env:PROJECT_VERSION}_js-js.tgz"
$null = I18N-Copy "${_target}" "${__dest}"
$___process = FS-Copy-File "${_target}" "${__dest}"
# copy all complimentary files to the workspace
$cmd = "PACKAGE-Assemble-LIB-Content"
$null = I18N-Check-Function "$cmd"
$___process = OS-Is-Command-Available "$cmd"
if ($___process -ne 0) {
$null = I18N-Copy-Failed
$null = I18N-Check-Failed
return 1
}

$null = I18N-Assemble-Package
$___process = PACKAGE-Assemble-LIB-Content `
"${_target}" `
"${_dest}" `
"${_target_filename}" `
"${_target_os}" `
"${_target_arch}"
switch ($___process) {
10 {
$null = I18N-Assemble-Skipped
return 0
} 0 {
# accepted
} Default {
$null = I18N-Assemble-Failed
return 1
}}


# report status
return 0
Expand Down
8 changes: 2 additions & 6 deletions automataCI/_release-checksum_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ function RELEASE-Run-CHECKSUM {
return 1
}

$___process = FS-Append-File "${__sha256_file}" @"
${__value} $TARGET
"@
$___process = FS-Append-File "${__sha256_file}" "${__value} $TARGET`n"
if ($___process -ne 0) {
$null = I18N-Checksum-Failed
return 1
Expand All @@ -121,9 +119,7 @@ ${__value} $TARGET
return 1
}

$___process = FS-Append-File "${__sha512_file}" @"
${__value} $TARGET
"@
$___process = FS-Append-File "${__sha512_file}" "${__value} $TARGET`n"
if ($___process -ne 0) {
$null = I18N-Checksum-Failed
return 1
Expand Down
1 change: 1 addition & 0 deletions automataCI/_release-staticrepo_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function RELEASE-Conclude-STATIC-REPO {
This is a re-purposed repository for housing various distribution ecosystem
such as but not limited to ``.deb``, ``.rpm``, ``.flatpak``, and etc for folks
to ``apt-get install``, ``yum install``, or ``flatpak install``.
"@

$null = I18N-Commit "STATIC REPO"
Expand Down
12 changes: 6 additions & 6 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 @@ -245,17 +245,17 @@ ${__common}|${__log}|PACKAGE_Run_IPK
return 1
fi

__log="${__log_directory}/msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
FS_Append_File "$__serial_control" "\
${__common}|${__log}|PACKAGE_Run_MSI
__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
fi

__log="${__log_directory}/npm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
__log="${__log_directory}/msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
FS_Append_File "$__serial_control" "\
${__common}|${__log}|PACKAGE_Run_NPM
${__common}|${__log}|PACKAGE_Run_MSI
"
if [ $? -ne 0 ]; then
return 1
Expand Down
25 changes: 19 additions & 6 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 @@ -198,6 +198,7 @@ foreach ($file in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_P
$__log = "${__log_directory}\archive_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-ARCHIVE
"@
if ($___process -ne 0) {
return 1
Expand All @@ -206,6 +207,7 @@ ${__common}|${__log}|PACKAGE-Run-ARCHIVE
$__log = "${__log_directory}\cargo_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-CARGO
"@
if ($___process -ne 0) {
return 1
Expand All @@ -214,6 +216,7 @@ ${__common}|${__log}|PACKAGE-Run-CARGO
$__log = "${__log_directory}\chocolatey_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-CHOCOLATEY
"@
if ($___process -ne 0) {
return 1
Expand All @@ -222,6 +225,7 @@ ${__common}|${__log}|PACKAGE-Run-CHOCOLATEY
$__log = "${__log_directory}\deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE-Run-DEB
"@
if ($___process -ne 0) {
return 1
Expand All @@ -230,6 +234,7 @@ ${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE-Run-DEB
$__log = "${__log_directory}\docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__serial_control}" @"
${__common}|${__log}|PACKAGE-Run-DOCKER
"@
if ($___process -ne 0) {
return 1
Expand All @@ -239,6 +244,7 @@ ${__common}|${__log}|PACKAGE-Run-DOCKER
$__log = "${__log_directory}\flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__serial_control}" @"
${__common}|${__flatpak_path}|${__log}|PACKAGE-Run-FLATPAK
"@
if ($___process -ne 0) {
return 1
Expand All @@ -247,6 +253,7 @@ ${__common}|${__flatpak_path}|${__log}|PACKAGE-Run-FLATPAK
$__log = "${__log_directory}\homebrew_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-HOMEBREW
"@
if ($___process -ne 0) {
return 1
Expand All @@ -255,22 +262,25 @@ ${__common}|${__log}|PACKAGE-Run-HOMEBREW
$__log = "${__log_directory}\ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-IPK
"@
if ($___process -ne 0) {
return 1
}

$__log = "${__log_directory}\msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__serial_control}" @"
${__common}|${__log}|PACKAGE-Run-MSI
$__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
}

$__log = "${__log_directory}\npm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$__log = "${__log_directory}\msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__serial_control}" @"
${__common}|${__log}|PACKAGE-Run-NPM
${__common}|${__log}|PACKAGE-Run-MSI
"@
if ($___process -ne 0) {
return 1
Expand All @@ -279,6 +289,7 @@ ${__common}|${__log}|PACKAGE-Run-NPM
$__log = "${__log_directory}\PDF_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-PDF
"@
if ($___process -ne 0) {
return 1
Expand All @@ -287,6 +298,7 @@ ${__common}|${__log}|PACKAGE-Run-PDF
$__log = "${__log_directory}\pypi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-PYPI
"@
if ($___process -ne 0) {
return 1
Expand All @@ -295,6 +307,7 @@ ${__common}|${__log}|PACKAGE-Run-PYPI
$__log = "${__log_directory}\rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log"
$___process = FS-Append-File "${__parallel_control}" @"
${__common}|${__log}|PACKAGE-Run-RPM
"@
if ($___process -ne 0) {
return 1
Expand Down
Loading

0 comments on commit 6c5849c

Please sign in to comment.