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
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Prebuilt binaries, so installing mobium does not need Go.
#
# A tag `v<version>` builds every platform with `make dist`, checks the
# archives against SHA256SUMS and runs the Linux binary to see it reports
# the tag's version, then attaches them to a GitHub Release of that tag.
# A pull request that touches this file or the Makefile does everything but
# the release, so the build is proven before a tag ever needs it.
#
# Nothing here signs or notarizes the macOS binaries: that needs an Apple
# Developer Program membership. docs/SETUP.md says what that means for
# someone who downloads one.

name: Release

on:
push:
tags: ['v*']
pull_request:
paths:
- Makefile
- .github/workflows/release.yml

permissions:
contents: read

jobs:
build:
name: Build and verify the release archives
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
clients/go/go.sum

# The tag names the version, without its leading v; a pull request
# gets one that cannot be mistaken for a release.
- name: Version
run: |
if [ "${GITHUB_REF_TYPE}" = tag ]; then v="${GITHUB_REF_NAME#v}"; else v="0.0.0-pr${{ github.event.number }}"; fi
echo "VERSION=$v" >> "$GITHUB_ENV"

- name: Test what is being released
run: make test

- name: make dist
run: make dist VERSION="$VERSION"

# Read back, not assumed: every archive against its checksum, and the
# binary asked what version it is.
- name: Verify
run: |
cd dist
shasum -a 256 -c SHA256SUMS
tar -xzf "mobium_${VERSION}_linux_amd64.tar.gz"
got=$("./mobium_${VERSION}_linux_amd64/mobium" --version)
echo "$got"
[ "$got" = "mobium version $VERSION" ] || { echo "the binary says '$got', not $VERSION"; exit 1; }
rm -rf "mobium_${VERSION}_linux_amd64"
ls -l

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error

publish:
name: Publish the release
needs: build
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Create the release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" dist/* \
--repo "$GITHUB_REPOSITORY" --verify-tag --title "mobium ${GITHUB_REF_NAME}" \
--notes "Prebuilt mobium for macOS, Linux and Windows, amd64 and arm64. Check a download against SHA256SUMS. The macOS binaries are not notarized; see docs/SETUP.md."
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
bin/
dist/
# Screenshots land here constantly during device work, so PNGs are ignored by
# default and the branding is excepted rather than the rule loosened.
*.png
Expand Down
24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BIN := bin/mobium
VERSION := $(shell cat VERSION 2>/dev/null || echo dev)

.PHONY: all build test fmt fmt-check vet lint clients java crosscompile api api-check flags flags-check quickstart license-check docs-check ci clean
.PHONY: all build dist test fmt fmt-check vet lint clients java crosscompile api api-check flags flags-check quickstart license-check docs-check ci clean

all: build test

Expand Down Expand Up @@ -74,6 +74,28 @@ clients:
# it, and that has broken before without anyone on a Mac noticing.
CROSS := windows/amd64 windows/arm64 linux/amd64 linux/arm64 darwin/amd64 darwin/arm64

# dist builds the release archives: every CROSS target, static and with no
# build paths in it, as mobium_<version>_<os>_<arch> — a .tar.gz, or a .zip
# for Windows — holding the binary, the license and its notices, and the
# README, with SHA256SUMS over them all. `make dist VERSION=0.1.0` for a
# release; the release workflow runs it on a tag.
DIST := dist

dist:
@rm -rf $(DIST) && mkdir -p $(DIST)
@for t in $(CROSS); do \
os=$${t%/*}; arch=$${t#*/}; ext=""; [ $$os = windows ] && ext=.exe; \
name=mobium_$(VERSION)_$${os}_$${arch}; dir=$(DIST)/$$name; mkdir -p $$dir; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -trimpath \
-ldflags "-s -w -X main.version=$(VERSION)" -o $$dir/mobium$$ext ./cmd/mobium || exit 1; \
cp LICENSE THIRD_PARTY_NOTICES.md README.md $$dir/; \
if [ $$os = windows ]; then (cd $(DIST) && zip -qr $$name.zip $$name) || exit 1; \
else tar -C $(DIST) -czf $(DIST)/$$name.tar.gz $$name || exit 1; fi; \
rm -rf $$dir; echo " $$name"; \
done
@cd $(DIST) && shasum -a 256 mobium_* > SHA256SUMS
@echo "wrote $(DIST)/SHA256SUMS"

crosscompile:
@for t in $(CROSS); do \
os=$${t%/*}; arch=$${t#*/}; \
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ person driving an emulator for it. People get the same commands.

Requirements:

- **Go 1.24+**, to install it — there are no prebuilt binaries yet
- **Go 1.24+**, to install it — prebuilt binaries arrive with the first
release ([SETUP.md](docs/SETUP.md#installing-a-release))
- **Android:** platform-tools on `PATH` (or `ANDROID_HOME`, or
`MOBIUM_ADB_PATH`), and an emulator or a phone with USB debugging on
- **iOS:** full Xcode and a booted simulator — or an iPhone on a cable, with
Expand Down
Loading
Loading