Skip to content

Commit

Permalink
Merge pull request #5731 from NipunaMadhushan/add-linux-arm-installer
Browse files Browse the repository at this point in the history
Generate linux-arm zip and installer
  • Loading branch information
NipunaMadhushan authored Oct 19, 2024
2 parents fdb18e9 + 2839b6e commit aa4d887
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 6 deletions.
48 changes: 47 additions & 1 deletion .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ jobs:
with:
name: Linux Installer rpm
path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm
- name: Archive Linux Installer ZIP
uses: actions/upload-artifact@v4
with:
name: Linux Installer ZIP
path: ballerina/build/distributions/ballerina-*-linux.zip
- name: Archive Linux-ARM Installer ZIP
uses: actions/upload-artifact@v4
with:
name: Linux-ARM Installer ZIP
path: ballerina/build/distributions/ballerina-*-linux-arm.zip
- name: Archive MacOS Installer ZIP
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -308,6 +318,42 @@ jobs:
env:
TEST_MODE_ACTIVE: true

ubuntu-arm-installer-build:

needs: ubuntu-build
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17.0.7'
- name: Download Linux-ARM Installer Zip
uses: actions/download-artifact@v4
with:
name: Linux-ARM Installer ZIP
- name: Create linux-arm deb
working-directory: installers/linux-deb
run: |
./build-ballerina-linux-deb-x64.sh -v ${{ needs.ubuntu-build.outputs.project-version }} -p ./../../ -a arm
echo "Created linux-arm-deb successfully"
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-linux-arm-x64.deb.sha256 installers/linux-deb/target/ballerina-*-linux-arm-x64.deb
- name: Archive Linux deb
uses: actions/upload-artifact@v4
with:
name: Linux-ARM Installer deb
path: installers/linux-deb/target/ballerina-*-linux-arm-x64.deb
- name: Archive Linux deb Hashes
uses: actions/upload-artifact@v4
with:
name: Linux deb Hashes
path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-linux-arm-x64.deb.sha256

macos-installer-build:

needs: ubuntu-build
Expand All @@ -321,7 +367,7 @@ jobs:
with:
distribution: 'temurin'
java-version: '17.0.7'
- name: Download MacOS Intaller Zip
- name: Download MacOS Installer Zip
uses: actions/download-artifact@v4
with:
name: MacOS Installer ZIP
Expand Down
105 changes: 103 additions & 2 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ configurations {
jBallerinaDistribution
ballerinaDistribution
ballerinaLinuxDistribution
ballerinaLinuxArmDistribution
ballerinaMacDistribution
ballerinaMacArmDistribution
ballerinaWindowsDistribution
Expand All @@ -47,6 +48,7 @@ dependencies {
def jBallerinaDistributionZip = file("$project.buildDir/distributions/ballerina-${shortVersion}.zip")
def ballerinaDistributionZip = file("$project.buildDir/distributions/ballerina-${ballerinaLangVersion}.zip")
def ballerinaLinuxDistributionZip = file("$project.buildDir/distributions/ballerina-linux-${ballerinaLangVersion}.zip")
def ballerinaLinuxArmDistributionZip = file("$project.buildDir/distributions/ballerina-linux-arm-${ballerinaLangVersion}.zip")
def ballerinaMacDistributionZip = file("$project.buildDir/distributions/ballerina-macos-${ballerinaLangVersion}.zip")
def ballerinaMacArmDistributionZip = file("$project.buildDir/distributions/ballerina-macos-arm-${ballerinaLangVersion}.zip")
def ballerinaWindowsDistributionZip = file("$project.buildDir/distributions/ballerina-windows-${ballerinaLangVersion}.zip")
Expand All @@ -56,6 +58,7 @@ task unpackBallerinaJre(type: Download) {
def jreBaseURL = "https://github.com/ballerina-platform/ballerina-custom-jre/releases/download/${ballerinaJreVersion}"
src([
"${jreBaseURL}/ballerina-jre-linux-64-${ballerinaJreVersion}.zip",
"${jreBaseURL}/ballerina-jre-linux-arm-64-${ballerinaJreVersion}.zip",
"${jreBaseURL}/ballerina-jre-macos-64-${ballerinaJreVersion}.zip",
"${jreBaseURL}/ballerina-jre-macos-arm-64-${ballerinaJreVersion}.zip",
"${jreBaseURL}/ballerina-jre-win-64-${ballerinaJreVersion}.zip"
Expand Down Expand Up @@ -167,6 +170,12 @@ task extractJreForLinux(type: Copy) {
into("${buildDir}/target/extracted-jre-linux")
}

task extractJreForLinuxArm(type: Copy) {
group = "extract_jre"
from zipTree { "${jreLocation}/ballerina-jre-linux-arm-64-${ballerinaJreVersion}.zip" }
into("${buildDir}/target/extracted-jre-linux-arm")
}

task extractJreForMac(type: Copy) {
group = "extract_jre"
from zipTree { "${jreLocation}/ballerina-jre-macos-64-${ballerinaJreVersion}.zip" }
Expand Down Expand Up @@ -536,6 +545,95 @@ task packageDistLinux(type: Zip) {
outputs.file ballerinaLinuxDistributionZip
}

task packageDistLinuxArm(type: Zip) {
group = "package_distribution"
description = 'Ballerina Linux-ARM Distribution Assembly'
ext {
baseName = "${distributionName}-${version}"
parentDir = "${baseName}-${codeName}-linux-arm"
}
archiveFileName = "${parentDir}.zip"
entryCompression = ZipEntryCompression.DEFLATED

into("${parentDir}/dependencies") {
from "build/target/extracted-jre-linux-arm"
fileMode = 0755
}
into("${parentDir}/distributions/ballerina-${shortVersion}/examples/") {
from "${project.rootDir}/examples/"
fileMode = 0755
}
// Code2Cloud Extension Examples
into("${parentDir}/distributions/ballerina-${shortVersion}/examples") {
from "build/target/extracted-distributions/c2c-examples-zip"
exclude "index.js"
}

/* Tools artifacts */
into("${parentDir}/distributions/ballerina-${shortVersion}") {
from "build/target/extracted-distributions/jballerina-tools-zip/jballerina-tools-${ballerinaLangVersion}"
exclude "distributions/ballerina-version"
exclude "distributions/installer-version"
exclude "/bin/bal.bat"
exclude "/bin/version.txt"
exclude "/LICENSE"
}
into("${parentDir}") {
from "../resources/tools"
exclude "distributions/ballerina-version"
exclude "distributions/installer-version"
exclude "**/scripts/**"
}

/* Files */
into("${parentDir}/distributions/ballerina-${shortVersion}") {
from "LICENSE"
}
into("${parentDir}/distributions/ballerina-${shortVersion}/bin") {
from "lib/version.txt"
fileMode = 0644
filter(ReplaceTokens, tokens: [version: version])
}
into("${parentDir}/distributions") {
from "../resources/tools/distributions/ballerina-version"
fileMode = 0644
filter(ReplaceTokens, tokens: [version: shortVersion])
}
into("${parentDir}/distributions") {
from "../resources/tools/distributions/installer-version"
fileMode = 0644
filter(ReplaceTokens, tokens: [uuid: installerVersion])
}
into("${parentDir}/bin") {
from "build/target/ballerina-command-${ballerinaCommandVersion}/bin/bal"
fileMode = 775
filter(ReplaceTokens, tokens: [ballerinaCommandVersion: ballerinaCommandVersion])
}
into("${parentDir}/lib") {
from "build/target/ballerina-command-${ballerinaCommandVersion}/lib/ballerina-command-${ballerinaCommandVersion}.jar"
fileMode = 0775
}
into("${parentDir}/scripts") {
from "build/target/ballerina-command-${ballerinaCommandVersion}/scripts/bal_completion.bash"
fileMode = 775
}
into("${parentDir}/scripts") {
from "build/target/ballerina-command-${ballerinaCommandVersion}/scripts/_bal"
fileMode = 775
}

/* Dependencies */
into("${parentDir}/distributions/ballerina-${shortVersion}/bre/lib") {
from configurations.exten
}

doLast {
println 'Ballerina Linux-ARM Distribution Packaged'
}

outputs.file ballerinaLinuxArmDistributionZip
}

task packageDistMac(type: Zip) {
group = "package_distribution"
description = 'Ballerina MacOS Distribution Assembly'
Expand Down Expand Up @@ -791,6 +889,7 @@ artifacts {
jBallerinaDistribution file: jBallerinaDistributionZip, builtBy: packageDist
ballerinaDistribution file: ballerinaDistributionZip, builtBy: packageDistZip
ballerinaLinuxDistribution file: ballerinaLinuxDistributionZip, builtBy: packageDistLinux
ballerinaLinuxArmDistribution file: ballerinaLinuxArmDistributionZip, builtBy: packageDistLinuxArm
ballerinaMacDistribution file: ballerinaMacDistributionZip, builtBy: packageDistMac
ballerinaMacArmDistribution file: ballerinaMacArmDistributionZip, builtBy: packageDistMacArm
ballerinaWindowsDistribution file: ballerinaWindowsDistributionZip, builtBy: packageDistWindows
Expand Down Expand Up @@ -1521,7 +1620,8 @@ generateCache.dependsOn copyDevToolsDocUi
/* Extract JRE */
extractJreForLinux.dependsOn unpackBalCommand
extractJreForMac.dependsOn extractJreForLinux
extractJreForMacArm.dependsOn extractJreForMac
extractJreForLinuxArm.dependsOn extractJreForMac
extractJreForMacArm.dependsOn extractJreForLinuxArm
extractJreForWindows.dependsOn extractJreForMacArm

copyOtherRepos.dependsOn extractJreForWindows
Expand All @@ -1540,7 +1640,8 @@ packageDist.dependsOn generateCache
packageDistZip.dependsOn packageDist
packageDistLinux.dependsOn packageDistZip
packageDistLinux.dependsOn unzipDistForTests
packageDistMac.dependsOn packageDistLinux
packageDistLinuxArm.dependsOn packageDistLinux
packageDistMac.dependsOn packageDistLinuxArm
packageDistMacArm.dependsOn packageDistMac
packageDistWindows.dependsOn packageDistMacArm
unzipDistForTests.dependsOn packageDistZip
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version=2201.11.0-SNAPSHOT
codeName=swan-lake

ballerinaLangVersion=2201.10.0
ballerinaJreVersion=2.0.0
ballerinaJreVersion=2.0.1
dependencyJREVersion=jdk-17.0.7+7-jre
specVersion=2024R1
slf4jVersion=1.7.30
Expand Down
24 changes: 22 additions & 2 deletions installers/linux-deb/build-ballerina-linux-deb-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ function printUsage() {
echo " version of the ballerina distribution"
echo " -p (--path)"
echo " path of the ballerina distributions"
echo " -a (--arch)"
echo " architecture of the ballerina distribution"
echo " If not specified : x86"
echo " arm : aarch64/arm64"
echo " -d (--dist)"
echo " ballerina distribution type either of the followings"
echo " If not specified both distributions will be built"
Expand All @@ -34,6 +38,11 @@ case ${key} in
shift # past argument
shift # past value
;;
-a|--arch)
ARCH="$2"
shift # past argument
shift # past value
;;
-d|--dist)
DISTRIBUTION="$2"
shift # past argument
Expand Down Expand Up @@ -62,8 +71,19 @@ if [ -z "$DISTRIBUTION" ]; then
BUILD_ALL_DISTRIBUTIONS=true
fi

if [ -z "$ARCH" ]; then
BALLERINA_PLATFORM=ballerina-${BALLERINA_VERSION}-linux
else
if [ "$ARCH" = "arm" ]; then
BALLERINA_PLATFORM=ballerina-${BALLERINA_VERSION}-linux-arm
else
echo "Please enter a valid architecture for the ballerina pack"
printUsage
exit 1
fi
fi

BALLERINA_DISTRIBUTION_LOCATION=${DIST_PATH}
BALLERINA_PLATFORM=ballerina-${BALLERINA_VERSION}-linux
BALLERINA_INSTALL_DIRECTORY=ballerina-${BALLERINA_VERSION}

echo "Build started at" $(date +"%Y-%m-%d %H:%M:%S")
Expand Down Expand Up @@ -108,7 +128,7 @@ function createBallerinaPlatform() {
createPackInstallationDirectory
copyDebianDirectory
mv target/${BALLERINA_INSTALL_DIRECTORY} target/ballerina-${BALLERINA_VERSION}-linux-x64
fakeroot dpkg-deb --build target/ballerina-${BALLERINA_VERSION}-linux-x64
fakeroot dpkg-deb --build target/${BALLERINA_PLATFORM}-x64
}

deleteTargetDirectory
Expand Down

0 comments on commit aa4d887

Please sign in to comment.