Skip to content

Commit 8228088

Browse files
committed
feat: restructure project with modular CI, Android build, CLI separation, and GUI updates
- Add reusable GitHub Action (`.github/actions/setup`) for Go, OpenGL headers, and fyne CLI - Update CI workflows: modularize desktop, CLI, and mobile builds; add Android support - Separate CLI (`ethiocal-cli` with bahir/convert/server) from GUI to reduce dependencies - Refactor Bahire-Hasab tab UI for responsive, mobile-friendly layout - Enhance date picker usability with year navigation in calendar - Update README with unified install and usage instructions for GUI/CLI/APK - Increment app version to 1.3.0 - Add Makefile targets for GUI, CLI, and mobile APK builds
1 parent 685ef93 commit 8228088

21 files changed

Lines changed: 575 additions & 483 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup
2+
description: Set up Go, with optional Linux OpenGL/X11 headers and the fyne CLI.
3+
4+
inputs:
5+
gl:
6+
description: Install Linux OpenGL/X11 headers (needed for CGO desktop builds).
7+
default: 'false'
8+
fyne:
9+
description: Install the fyne CLI.
10+
default: 'false'
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: '1.26'
18+
19+
- if: inputs.gl == 'true' && runner.os == 'Linux'
20+
shell: bash
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y gcc libgl1-mesa-dev xorg-dev
24+
25+
- if: inputs.fyne == 'true'
26+
shell: bash
27+
run: go install fyne.io/tools/cmd/fyne@latest

.github/workflows/ci.yml

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
16-
- name: Set up Go
17-
uses: actions/setup-go@v5
15+
- uses: ./.github/actions/setup
1816
with:
19-
go-version: '1.26'
20-
21-
- name: Install system dependencies
22-
run: |
23-
sudo apt-get update
24-
sudo apt-get install -y gcc libgl1-mesa-dev xorg-dev
17+
gl: 'true'
2518

2619
- name: golangci-lint
2720
uses: golangci/golangci-lint-action@v7
@@ -32,84 +25,96 @@ jobs:
3225
runs-on: ubuntu-latest
3326
steps:
3427
- uses: actions/checkout@v4
35-
36-
- name: Set up Go
37-
uses: actions/setup-go@v5
28+
- uses: ./.github/actions/setup
3829
with:
39-
go-version: '1.26'
40-
41-
- name: Install system dependencies
42-
run: |
43-
sudo apt-get update
44-
sudo apt-get install -y gcc libgl1-mesa-dev xorg-dev
30+
gl: 'true'
4531

4632
- name: Test
4733
run: go test -v -cover ./...
4834

49-
# Package platform-native app bundles on each OS runner (CGO requires native C compiler).
50-
package:
35+
# Desktop: GUI bundle + native CLI/server binary, built per OS then uploaded.
36+
desktop:
5137
if: startsWith(github.ref, 'refs/tags/v')
5238
needs: [ lint, test ]
5339
strategy:
5440
fail-fast: false
5541
matrix:
5642
include:
57-
- runner: ubuntu-latest
58-
os: linux
59-
artifact: ethiocal-linux-amd64.tar.xz
60-
- runner: macos-latest
61-
os: darwin
62-
artifact: ethiocal-macos-arm64.app.zip
63-
- runner: macos-15-intel
64-
os: darwin
65-
artifact: ethiocal-macos-amd64.app.zip
66-
- runner: windows-latest
67-
os: windows
68-
artifact: ethiocal-windows-amd64.exe.zip
43+
- { runner: ubuntu-latest, os: linux, artifact: ethiocal-linux-amd64.tar.xz, cli: ethiocal-cli-linux-amd64 }
44+
- { runner: macos-latest, os: darwin, artifact: ethiocal-macos-arm64.app.zip, cli: ethiocal-cli-macos-arm64 }
45+
- { runner: macos-15-intel, os: darwin, artifact: ethiocal-macos-amd64.app.zip, cli: ethiocal-cli-macos-amd64 }
46+
- { runner: windows-latest, os: windows, artifact: ethiocal-windows-amd64.exe.zip, cli: ethiocal-cli-windows-amd64.exe }
6947

7048
runs-on: ${{ matrix.runner }}
7149
steps:
7250
- uses: actions/checkout@v4
73-
74-
- name: Set up Go
75-
uses: actions/setup-go@v5
51+
- uses: ./.github/actions/setup
7652
with:
77-
go-version: '1.26'
53+
gl: 'true'
54+
fyne: 'true'
7855

79-
- name: Install system dependencies (Linux)
80-
if: matrix.os == 'linux'
81-
run: |
82-
sudo apt-get update
83-
sudo apt-get install -y gcc libgl1-mesa-dev xorg-dev
84-
85-
- name: Install fyne CLI
86-
run: go install fyne.io/tools/cmd/fyne@latest
87-
88-
- name: Package
56+
# Build both: GUI bundle (CGO) and CLI (pure Go).
57+
- name: Build GUI bundle
8958
run: fyne package -os ${{ matrix.os }} -release
9059

91-
- name: Prepare artifact (macOS)
60+
- name: Build CLI
61+
env:
62+
CGO_ENABLED: '0'
63+
run: go build -trimpath -ldflags '-s -w' -o ${{ matrix.cli }} ./cmd/ethiocal-cli
64+
65+
# Pack the GUI bundle into one named file (fyne's output differs per OS).
66+
- name: Pack GUI bundle (macOS)
9267
if: matrix.os == 'darwin'
9368
run: zip -r ${{ matrix.artifact }} Ethiocal.app
9469

95-
- name: Prepare artifact (Linux)
70+
- name: Pack GUI bundle (Linux)
9671
if: matrix.os == 'linux'
9772
run: mv Ethiocal.tar.xz ${{ matrix.artifact }}
9873

99-
- name: Prepare artifact (Windows)
74+
- name: Pack GUI bundle (Windows)
10075
if: matrix.os == 'windows'
10176
shell: pwsh
10277
run: Compress-Archive -Path Ethiocal.exe -DestinationPath ${{ matrix.artifact }}
10378

104-
- name: Upload artifact
79+
- name: Upload GUI bundle
10580
uses: actions/upload-artifact@v4
10681
with:
10782
name: ${{ matrix.artifact }}
10883
path: ${{ matrix.artifact }}
10984

85+
- name: Upload CLI
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: ${{ matrix.cli }}
89+
path: ${{ matrix.cli }}
90+
91+
# Mobile: arm64-v8a APK. Debug-signed for sideloading;
92+
# NDK preinstalled on the runner; metadata from FyneApp.toml.
93+
mobile:
94+
if: startsWith(github.ref, 'refs/tags/v')
95+
needs: [ lint, test ]
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: actions/checkout@v4
99+
- uses: ./.github/actions/setup
100+
with:
101+
fyne: 'true'
102+
103+
# Uses the runner's preinstalled NDK via its default ANDROID_NDK_HOME.
104+
- name: Build APK
105+
run: |
106+
fyne package --os android/arm64
107+
mv Ethiocal.apk ethiocal-android.apk
108+
109+
- name: Upload APK
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: ethiocal-android.apk
113+
path: ethiocal-android.apk
114+
110115
release:
111116
if: startsWith(github.ref, 'refs/tags/v')
112-
needs: package
117+
needs: [ desktop, mobile ]
113118
runs-on: ubuntu-latest
114119
permissions:
115120
contents: write

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.vscode/
22
.idea
3-
ethiocal
3+
ethiocal
4+
*.apk

FyneApp.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Website = "https://github.com/yinebebt/ethiocal"
44
Icon = "logo.png"
55
Name = "Ethiocal"
66
ID = "com.github.yinebebt.ethiocal"
7-
Version = "1.2.1"
8-
Build = 2
7+
Version = "1.3.0"
8+
Build = 3

Makefile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
11
all: build
22

3+
# Build both binaries: GUI app and CLI/server tool.
4+
build:
5+
go build -o ethiocal .
6+
CGO_ENABLED=0 go build -o ethiocal-cli ./cmd/ethiocal-cli
7+
38
test:
49
go test -v -cover ./...
510

611
lint:
712
golangci-lint run ./...
813

14+
# Run the GUI app.
915
run:
1016
go run .
1117

12-
build:
13-
go build -o ethiocal .
18+
# Run the CLI tool, e.g. make run-cli ARGS="convert gtoe 2024 9 11".
19+
run-cli:
20+
go run ./cmd/ethiocal-cli $(ARGS)
1421

1522
clean:
16-
rm -f ethiocal
23+
rm -f ethiocal ethiocal-cli
1724

1825
package:
1926
fyne package -release
2027

21-
.PHONY: all test lint run build clean package
28+
# Slim arm64 APK. Resolves the NDK from ANDROID_NDK_HOME or the newest under $ANDROID_HOME/ndk.
29+
package-android:
30+
@ndk="$${ANDROID_NDK_HOME:-$$(ls -d $$ANDROID_HOME/ndk/* 2>/dev/null | sort -V | tail -1)}"; \
31+
[ -n "$$ndk" ] || { echo "No NDK: set ANDROID_NDK_HOME or install one under $$ANDROID_HOME/ndk"; exit 1; }; \
32+
ANDROID_NDK_HOME="$$ndk" fyne package --os android/arm64
33+
34+
.PHONY: all build test lint run run-cli clean package package-android

README.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ plus a 5- or 6-day 13th month).
1616

1717
### Features
1818

19-
* **GUI desktop app**launch with no arguments for a graphical interface.
20-
* **CLI** — subcommands for scripting and terminal use.
21-
* **HTTP API** — run as a server for integration with other services.
19+
* **GUI app**graphical interface for desktop (macOS/Linux/Windows) and Android.
20+
* **CLI**`ethiocal-cli` subcommands for scripting and terminal use.
21+
* **HTTP API** — run `ethiocal-cli --server` for integration with other services.
2222
* Get Ethiopian fasting and religious festival dates for a specific year.
2323
* Convert Ethiopian dates to Gregorian dates and vice versa.
2424

@@ -34,6 +34,9 @@ Pre-built binaries are available on the [Releases](https://github.com/yinebebt/e
3434
| macOS (Intel) | `curl -Lo ethiocal.zip https://github.com/yinebebt/ethiocal/releases/latest/download/ethiocal-macos-amd64.app.zip && unzip ethiocal.zip` |
3535
| Linux (x86_64) | `curl -Lo ethiocal.tar.xz https://github.com/yinebebt/ethiocal/releases/latest/download/ethiocal-linux-amd64.tar.xz && tar xJf ethiocal.tar.xz` |
3636
| Windows (x86_64) | `curl -Lo ethiocal.zip https://github.com/yinebebt/ethiocal/releases/latest/download/ethiocal-windows-amd64.exe.zip && unzip ethiocal.zip` |
37+
| Android (arm64) | [`ethiocal-android.apk`](https://github.com/yinebebt/ethiocal/releases/latest) — sideload on a 64-bit device |
38+
39+
The CLI/server tool ships per platform too, as `ethiocal-cli-<os>-<arch>` on the same Releases page.
3740

3841
### Install with Go
3942

@@ -46,45 +49,49 @@ go install github.com/yinebebt/ethiocal@latest
4649
```bash
4750
git clone https://github.com/yinebebt/ethiocal.git
4851
cd ethiocal
49-
go build -o ethiocal .
52+
make build # builds both: ./ethiocal (GUI) and ./ethiocal-cli (CLI + server)
5053
```
5154

52-
> **Note:** Building requires a C compiler and OpenGL headers because Fyne uses
53-
> CGO. On Ubuntu/Debian: `sudo apt-get install libgl1-mesa-dev xorg-dev`.
54-
> macOS and Windows have these out of the box.
55+
> **Note:** Building the GUI app requires a C compiler and OpenGL headers because
56+
> Fyne uses CGO. On Ubuntu/Debian: `sudo apt-get install libgl1-mesa-dev xorg-dev`.
57+
> macOS and Windows have these out of the box. The CLI builds with pure Go (no CGO).
5558
5659
## Usage
5760

58-
### GUI (default)
61+
### GUI
5962

60-
Run `ethiocal` with no arguments to launch the desktop app:
63+
Run `ethiocal` (or launch the packaged app) to open the GUI:
6164

6265
```bash
6366
ethiocal
6467
```
6568

6669
The GUI provides two tabs:
6770

68-
* **Date Converter** — pick a direction (Gregorian → Ethiopian or Ethiopian → Gregorian), enter a date, and convert.
71+
* **Date Converter** — pick a direction (Gregorian → Ethiopian or Ethiopian → Gregorian), pick a date from the calendar, and convert.
6972
* **Bahire-Hasab** — enter an Ethiopian year to view all fasting and festival dates.
7073

7174
### CLI
7275

76+
The terminal/server tool is a separate binary (`ethiocal-cli`), so the GUI app
77+
carries no CLI dependencies. Install with
78+
`go install github.com/yinebebt/ethiocal/cmd/ethiocal-cli@latest`.
79+
7380
```bash
7481
# Get religious dates for Ethiopian year 2017
75-
ethiocal bahir 2017
82+
ethiocal-cli bahir 2017
7683

7784
# Convert Gregorian date to Ethiopian (year month day as separate args)
78-
ethiocal convert gtoe 2025 2 2
85+
ethiocal-cli convert gtoe 2025 2 2
7986

8087
# Convert Ethiopian date to Gregorian
81-
ethiocal convert etog 2017 5 25
88+
ethiocal-cli convert etog 2017 5 25
8289
```
8390

8491
### HTTP Server
8592

8693
```bash
87-
ethiocal --server
94+
ethiocal-cli --server
8895
```
8996

9097
Starts the API on port `8080` (override with the `PORT` environment variable).

bahirehasab/bahirehasab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func getBasic(year int) Basic {
131131
DateOfTheMonth: mebajaHamer,
132132
MonthOfTheYear: 5,
133133
}
134-
} else if bealeMetq == 2 || (bealeMetq == 1 && mebajaHamer > 30) {
134+
} else if bealeMetq == 2 || bealeMetq == 1 {
135135
nenewie = Date{
136136
DateOfTheMonth: mebajaHamer % 30,
137137
MonthOfTheYear: 6,

cmd/bahir.go renamed to cmd/ethiocal-cli/bahir.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cmd
1+
package main
22

33
import (
44
"fmt"

0 commit comments

Comments
 (0)