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 9c72753 commit 1128c76
Show file tree
Hide file tree
Showing 49 changed files with 1,255 additions and 589 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
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: 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
36 changes: 32 additions & 4 deletions automataCI/services/archive/tar.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,34 @@ function TAR-Create-GZ {
return 1
}

if ($($___destination -replace '\.tgz.*$') -ne $___destination) {
$___dest = "$($___destination -replace '\.tgz.*$')"
} else {
$___dest = "$($___destination -replace '\.tar.gz.*$')"
}


# create tar archive
$___dest = $___destination -replace '\.gz.*$'
$___process = TAR-Create "${___dest}" "${___source}" "${___owner}" "${___group}"
if ($___process -ne 0) {
return 1
}


# compress archive
$___process = GZ-Create "${___dest}"
if ($___process -ne 0) {
return 1
}


# rename to target
$___process = FS-Move "${___dest}.gz" "${___destination}"
if ($___process -ne 0) {
return 1
}


# report status
return 0
}
Expand Down Expand Up @@ -172,15 +186,29 @@ function TAR-Create-XZ {
return 1
}

if ($($___destination -replace '\.txz.*$') -ne $___destination) {
$___dest = "$($___destination -replace '\.txz.*$')"
} else {
$___dest = "$($___destination -replace '\.tar.xz.*$')"
}


# create tar archive
$___destination = $___destination -replace '\.xz.*$'
$___process = TAR-Create "${___destination}" "${___source}" "${___owner}" "${___group}"
$___process = TAR-Create "${___dest}" "${___source}" "${___owner}" "${___group}"
if ($___process -ne 0) {
return 1
}

$___process = XZ-Create "${___destination}"

# compress archive
$___process = XZ-Create "${___dest}"
if ($___process -ne 0) {
return 1
}


# rename to target
$___process = FS-Move "${___dest}.xz" "${___destination}"
if ($___process -ne 0) {
return 1
}
Expand Down
Loading

0 comments on commit 1128c76

Please sign in to comment.