Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/platform-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Generated Web App Platform Compile

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
linux-arm64:
name: Linux ARM64 generated web app
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6

- name: Install Crystal
uses: crystal-lang/install-crystal@d8ef131ecec0352ce0e39b81b0a6d95def58fe2f # v1
with:
crystal: latest

- name: Install CLI dependencies
run: shards install

- name: Build Amber CLI
run: crystal build src/amber_cli.cr --no-debug -o amber

- name: Compile generated Amber V2 web app
run: scripts/smoke_generated_web.sh ./amber

windows-x86-64:
name: Windows x86_64 generated web app (candidate framework fix)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6

- name: Install Crystal
uses: crystal-lang/install-crystal@d8ef131ecec0352ce0e39b81b0a6d95def58fe2f # v1
with:
crystal: latest

- name: Install Windows native libraries
shell: pwsh
run: |
& "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install sqlite3:x64-windows
$crystalLibraryPath = (& crystal env CRYSTAL_LIBRARY_PATH).Trim()
"CRYSTAL_LIBRARY_PATH=$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\lib;$crystalLibraryPath" >> $env:GITHUB_ENV
"$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\bin" >> $env:GITHUB_PATH

- name: Install CLI dependencies
run: shards install

- name: Build Amber CLI
run: crystal build src/amber_cli.cr --no-debug -o amber.exe

- name: Compile generated Amber V2 web app
shell: pwsh
run: scripts/smoke_generated_web.ps1 ./amber.exe c95090f752f4cd01c0762c65e6398456631c2c0e
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- target: linux-x86_64
os: ubuntu-latest
crystal_arch: x86_64
- target: linux-arm64
os: ubuntu-24.04-arm
crystal_arch: aarch64

steps:
- name: Checkout code
Expand All @@ -36,7 +39,7 @@ jobs:
ref: ${{ github.event.release.tag_name || github.event.inputs.ref }}

- name: Install Crystal (Linux)
if: matrix.target == 'linux-x86_64'
if: startsWith(matrix.target, 'linux-')
uses: crystal-lang/install-crystal@v1
with:
crystal: latest
Expand All @@ -63,8 +66,8 @@ jobs:
shards install
fi

- name: Build binaries (Linux x86_64)
if: matrix.target == 'linux-x86_64'
- name: Build binaries (Linux)
if: startsWith(matrix.target, 'linux-')
run: |
crystal build src/amber_cli.cr -o amber --release --static
crystal build src/amber_lsp.cr -o amber-lsp --release --static
Expand Down Expand Up @@ -135,7 +138,9 @@ jobs:
artifacts/amber_cli-darwin-arm64/amber_cli-darwin-arm64.tar.gz \
artifacts/amber_cli-darwin-arm64/amber_cli-darwin-arm64.tar.gz.sha256 \
artifacts/amber_cli-linux-x86_64/amber_cli-linux-x86_64.tar.gz \
artifacts/amber_cli-linux-x86_64/amber_cli-linux-x86_64.tar.gz.sha256; do
artifacts/amber_cli-linux-x86_64/amber_cli-linux-x86_64.tar.gz.sha256 \
artifacts/amber_cli-linux-arm64/amber_cli-linux-arm64.tar.gz \
artifacts/amber_cli-linux-arm64/amber_cli-linux-arm64.tar.gz.sha256; do
if [ ! -f "$f" ]; then
echo "ERROR: expected file not found: $f"
echo "Artifact tree:"
Expand All @@ -153,6 +158,8 @@ jobs:
artifacts/amber_cli-darwin-arm64/amber_cli-darwin-arm64.tar.gz.sha256
artifacts/amber_cli-linux-x86_64/amber_cli-linux-x86_64.tar.gz
artifacts/amber_cli-linux-x86_64/amber_cli-linux-x86_64.tar.gz.sha256
artifacts/amber_cli-linux-arm64/amber_cli-linux-arm64.tar.gz
artifacts/amber_cli-linux-arm64/amber_cli-linux-arm64.tar.gz.sha256
tag_name: ${{ github.event.release.tag_name }}
fail_on_unmatched_files: true
env:
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ creates the supported Amber `2.0.0-beta.2` ECR web application and includes
development, generator, database, and LSP tooling.

Amber V2 is a beta. The release-gated path is a web application on Apple
Silicon macOS or x86_64 Linux. See [Generator support](docs/GENERATOR_SUPPORT.md)
Silicon macOS or x86_64 Linux. Linux ARM64 generated-app compilation is checked
in CI; its first direct archive will ship with the next CLI release. See [Generator support](docs/GENERATOR_SUPPORT.md)
before relying on persistence, authentication, API-resource, or native output.

## Install
Expand All @@ -30,7 +31,10 @@ the `amber_cli` formula.

### Direct release archive

Use `darwin-arm64` on Apple Silicon macOS or `linux-x86_64` on x86_64 Linux:
CLI `2.0.3` publishes `darwin-arm64` for Apple Silicon macOS and
`linux-x86_64` for x86_64 Linux. The release workflow now also builds
`linux-arm64`; that archive becomes available with the next published CLI
version.

```bash
version=v2.0.3
Expand All @@ -48,6 +52,27 @@ amber --version
On Linux, use `sha256sum -c` for the checksum. Prefix only the `install`
command with `sudo` if `/usr/local/bin` is not writable.

### Linux ARM64 source install for 2.0.3

CLI `2.0.3` does not contain a `linux-arm64` archive. On an ARM64 Linux host,
build that tagged source instead of downloading the x86_64 binary:

```bash
sudo apt-get update
sudo apt-get install -y libsqlite3-dev
git clone --branch v2.0.3 --depth 1 https://github.com/amberframework/amber_cli.git
cd amber_cli
shards install --production
crystal build src/amber_cli.cr -o amber --release
crystal build src/amber_lsp.cr -o amber-lsp --release
sudo install -m 0755 amber amber-lsp /usr/local/bin/
amber --version
```

Run the clone command from a directory where the temporary `amber_cli/`
checkout can be created. The next CLI release workflow now builds and smoke
tests a native `linux-arm64` archive on a GitHub-hosted ARM64 Linux runner.

## Create and verify a web app

```bash
Expand Down
9 changes: 8 additions & 1 deletion scripts/build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ case "${OS}" in
fi
;;
"linux")
TARGET="linux-x86_64"
case "${ARCH}" in
"x86_64"|"amd64") TARGET="linux-x86_64" ;;
"aarch64"|"arm64") TARGET="linux-arm64" ;;
*)
echo "❌ Unsupported Linux architecture: ${ARCH}"
exit 1
;;
esac
BUILD_CLI="crystal build src/amber_cli.cr -o amber --release --static"
BUILD_LSP="crystal build src/amber_lsp.cr -o amber-lsp --release --static"
CHECKSUM_CMD="sha256sum"
Expand Down
62 changes: 62 additions & 0 deletions scripts/smoke_generated_web.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$Cli,
[Parameter(Position = 1)]
[string]$FrameworkCommit = ""
)

$ErrorActionPreference = "Stop"

function Invoke-Checked {
param(
[Parameter(Mandatory = $true)]
[string]$Command,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$Arguments
)

& $Command @Arguments
if ($LASTEXITCODE -ne 0) {
throw "$Command failed with exit code $LASTEXITCODE"
}
}

$cliPath = (Resolve-Path $Cli).Path
$smokeRoot = Join-Path $env:RUNNER_TEMP "amber-v2-windows-smoke"
$appPath = Join-Path $smokeRoot "amber_beta_smoke"

if (Test-Path $smokeRoot) {
Remove-Item -Recurse -Force $smokeRoot
}
New-Item -ItemType Directory -Force $smokeRoot | Out-Null

Invoke-Checked -Command $cliPath -Arguments @("new", $appPath, "--type", "web", "--no-deps")

if ($FrameworkCommit) {
$shardPath = Join-Path $appPath "shard.yml"
$manifest = [System.IO.File]::ReadAllText($shardPath)
$releasedFramework = " version: 2.0.0-beta.2"
if (-not $manifest.Contains($releasedFramework)) {
throw "Generated shard.yml does not contain the expected Amber beta pin"
}
$manifest = $manifest.Replace(
$releasedFramework,
" commit: $FrameworkCommit"
)
[System.IO.File]::WriteAllText($shardPath, $manifest)
}

Push-Location $appPath
try {
Invoke-Checked -Command "shards" -Arguments @("install")
Invoke-Checked -Command "crystal" -Arguments @("spec")
New-Item -ItemType Directory -Force bin | Out-Null
Invoke-Checked -Command "crystal" -Arguments @(
"build",
"src/amber_beta_smoke.cr",
"-o",
"bin/amber_beta_smoke.exe"
)
} finally {
Pop-Location
}
Loading