Skip to content

Commit

Permalink
Generate OS package for aarch64 and let sdkman know
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurz committed Jan 12, 2023
1 parent 8ba8022 commit 71807b8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
27 changes: 22 additions & 5 deletions .github/scripts/generate-os-packages.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/usr/bin/env bash
set -eu

ARCHITECTURE="x86_64" # Set the default architecture
if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then
# When running on macOS and Linux lets determine the architecture
ARCHITECTURE=$(uname -m)
fi
if [[ $# -eq 1 ]]; then
# architecture gets overridden by command line param
ARCHITECTURE=$1
fi

ARTIFACTS_DIR="artifacts/"
mkdir -p "$ARTIFACTS_DIR"

Expand Down Expand Up @@ -103,10 +113,15 @@ generate_sdk() {
local binName

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sdkDirectory="scala-cli-x86_64-pc-linux-static-sdk"
if [[ "$ARCHITECTURE" == "aarch64" ]] || [[ "$ARCHITECTURE" == "x86_64" ]]; then
sdkDirectory="scala-cli-$ARCHITECTURE-pc-linux-static-sdk"
else
echo "scala-cli is not supported on $ARCHITECTURE"
exit 2
fi
binName="scala-cli"
elif [[ "$OSTYPE" == "darwin"* ]]; then
if [[ "$(uname -m)" == "arm64" ]]; then
if [[ "$ARCHITECTURE" == "arm64" ]]; then
sdkDirectory="scala-cli-aarch64-apple-darwin-sdk"
else
sdkDirectory="scala-cli-x86_64-apple-darwin-sdk"
Expand All @@ -133,11 +148,13 @@ generate_sdk() {
}

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
generate_deb
generate_rpm
if [ "$ARCHITECTURE" == "x86_64" ]; then
generate_deb
generate_rpm
fi
generate_sdk
elif [[ "$OSTYPE" == "darwin"* ]]; then
if [ "$(uname -m)" == "arm64" ]; then
if [ "$ARCHITECTURE" == "arm64" ]; then
generate_pkg "aarch64"
else
generate_pkg "x86_64"
Expand Down
8 changes: 4 additions & 4 deletions .github/scripts/publish-sdkman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ version() {
}

SCALA_CLI_VERSION="$(version)"
ARCHS=("x86_64" "x86_64" "aarch64" "x86_64")
UNAMES=("pc-linux-static-sdk" "apple-darwin-sdk" "apple-darwin-sdk" "pc-win32-sdk")
PLATFORMS=("LINUX_64" "MAC_OSX" "MAC_ARM64" "WINDOWS_64")
ARCHS=("x86_64" "aarch64" "x86_64" "aarch64" "x86_64")
UNAMES=("pc-linux-static-sdk" "pc-linux-static-sdk" "apple-darwin-sdk" "apple-darwin-sdk" "pc-win32-sdk")
PLATFORMS=("LINUX_64" "LINUX_ARM64" "MAC_OSX" "MAC_ARM64" "WINDOWS_64")

for i in "${!PLATFORMS[@]}"; do

SCALA_CLI_URL="https://github.com/VirtuslabRnD/scala-cli/releases/download/v$SCALA_CLI_VERSION/scala-cli-${ARCHS[i]}-${UNAMES[i]}.zip"
SCALA_CLI_URL="https://github.com/VirtusLab/scala-cli/releases/download/v$SCALA_CLI_VERSION/scala-cli-${ARCHS[i]}-${UNAMES[i]}.zip"

# Release a new Candidate Version
curl --silent --show-error --fail \
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ jobs:
env: |
JAVA_HOME: /jvm
JAVA_OPTS: "-Djdk.lang.Process.launchMechanism=vfork"
GITHUB_ENV: "/tmp/github_env"
# The shell to run commands with in the container
shell: /bin/bash
Expand All @@ -228,12 +229,18 @@ jobs:
# gnupg2 is for signing the resulting binary.
install: |
apt-get update -q -y
apt-get install -q -y build-essential libz-dev git python3-pip gnupg2 curl
apt-get install -q -y build-essential libz-dev git python3-pip gnupg2 curl zip
touch /tmp/github_env
run: |
set -e
export PATH="/utils:$PATH"
git config --global --add safe.directory "$(pwd)"
./mill -i copyDefaultLauncher artifacts/
./mill -i ci.setShouldPublish
if grep -q "SHOULD_PUBLISH=true" /tmp/github_env; then
.github/scripts/generate-os-packages.sh
fi
- run: sudo chown -R $USER .
- uses: actions/upload-artifact@v3
with:
name: linux-aarch64-launchers
Expand Down Expand Up @@ -997,6 +1004,10 @@ jobs:
with:
name: linux-launchers
path: artifacts/
- uses: actions/download-artifact@v3
with:
name: linux-aarch64-launchers
path: artifacts/
- uses: actions/download-artifact@v3
with:
name: macos-launchers
Expand Down

0 comments on commit 71807b8

Please sign in to comment.