Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.85.2 #951

Merged
merged 6 commits into from
Oct 8, 2023
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
71 changes: 60 additions & 11 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,54 @@ jobs:
sha: context.sha
})

build-android:
name: Build Android
runs-on: ubuntu-latest
needs: [version]
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: ${{ env.GO_VERSION_FILE }}
check-latest: ${{ env.CHECK_LATEST }}
cache: false
-
name: Build binary for arm
env:
VERSION: ${{ needs.version.outputs.semver_tag }}
shell: bash
# 2 is the number of virtual cpus for Linux. macOS is 3.
run: make -j2 build-android-arm CC="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang"
-
name: Build binary for arm64
env:
VERSION: ${{ needs.version.outputs.semver_tag }}
shell: bash
# 2 is the number of virtual cpus for Linux. macOS is 3.
run: make -j2 build-android-arm64
-
name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: binaries
path: build/
-
name: Remove tag if failure
if: ${{ failure() }}
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/${{ needs.version.outputs.semver_tag }}"
})

build-linux:
name: Build Linux
runs-on: ubuntu-latest
Expand All @@ -266,8 +314,8 @@ jobs:
env:
VERSION: ${{ needs.version.outputs.semver_tag }}
shell: bash
# 3 is the number of virtual cpus for macOS. Linux is only 2.
run: make -j3 build-all-linux
# 2 is the number of virtual cpus for Linux. macOS is 3.
run: make -j2 build-all-linux
-
name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -307,8 +355,8 @@ jobs:
env:
VERSION: ${{ needs.version.outputs.semver_tag }}
shell: bash
# 3 is the number of virtual cpus for macOS. Linux is only 2.
run: make -j3 build-all-freebsd
# 2 is the number of virtual cpus for Linux. macOS is 3.
run: make -j2 build-all-freebsd
-
name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -348,8 +396,8 @@ jobs:
env:
VERSION: ${{ needs.version.outputs.semver_tag }}
shell: bash
# 3 is the number of virtual cpus for macOS. Linux is only 2.
run: make -j3 build-all-netbsd
# 2 is the number of virtual cpus for Linux. macOS is 3.
run: make -j2 build-all-netbsd
-
name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -389,8 +437,8 @@ jobs:
env:
VERSION: ${{ needs.version.outputs.semver_tag }}
shell: bash
# 3 is the number of virtual cpus for macOS. Linux is only 2.
run: make -j3 build-all-openbsd
# 2 is the number of virtual cpus for Linux. macOS is 3.
run: make -j2 build-all-openbsd
-
name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -453,7 +501,7 @@ jobs:

build-windows:
name: Build Windows
runs-on: ubuntu-latest
runs-on: windows-latest
needs: [version]
steps:
-
Expand All @@ -471,8 +519,8 @@ jobs:
env:
VERSION: ${{ needs.version.outputs.semver_tag }}
shell: bash
# 3 is the number of virtual cpus for macOS. Linux is only 2.
run: make -j3 build-all-windows
# 2 is the number of virtual cpus for Windows. macOS is 3.
run: make -j2 build-all-windows
-
name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -552,6 +600,7 @@ jobs:
runs-on: ubuntu-latest
needs: [
version,
build-android,
build-linux,
build-freebsd,
build-netbsd,
Expand Down
58 changes: 35 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# globals
BINARY_NAME?=wakatime-cli
BUILD_DIR?="./build"
CGO_ENABLED?=0
COMMIT?=$(shell git rev-parse --short HEAD)
DATE?=$(shell date -u '+%Y-%m-%dT%H:%M:%S %Z')
REPO=github.com/wakatime/wakatime-cli
Expand Down Expand Up @@ -37,89 +38,100 @@ else
endif

# targets
build-all: build-darwin build-freebsd build-linux build-netbsd build-openbsd build-windows
build-all: build-all-android build-darwin build-freebsd build-linux build-netbsd build-openbsd build-windows

build-all-android: build-android-arm build-android-arm64

# to build for android arm, you need to have the android ndk installed, enable CGO and
# set CC to the path of the android ndk toolchain
# example: CC=/path/to/Android/sdk/ndk/26.0.10792818/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi34-clang
build-android-arm:
GOOS=android GOARCH=arm CGO_ENABLED=1 $(MAKE) build

build-android-arm64:
GOOS=android GOARCH=arm64 $(MAKE) build

build-all-darwin: build-darwin-amd64 build-darwin-arm64

build-darwin-amd64:
GOOS=darwin GOARCH=amd64 make build
GOOS=darwin GOARCH=amd64 $(MAKE) build

build-darwin-arm64:
GOOS=darwin GOARCH=arm64 make build
GOOS=darwin GOARCH=arm64 $(MAKE) build

build-all-freebsd: build-freebsd-386 build-freebsd-amd64 build-freebsd-arm

build-freebsd-386:
GOOS=freebsd GOARCH=386 make build
GOOS=freebsd GOARCH=386 $(MAKE) build

build-freebsd-amd64:
GOOS=freebsd GOARCH=amd64 make build
GOOS=freebsd GOARCH=amd64 $(MAKE) build

build-freebsd-arm:
GOOS=freebsd GOARCH=arm make build
GOOS=freebsd GOARCH=arm $(MAKE) build

build-all-linux: build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-riscv64

build-linux-386:
GOOS=linux GOARCH=386 make build
GOOS=linux GOARCH=386 $(MAKE) build

build-linux-amd64:
GOOS=linux GOARCH=amd64 make build
GOOS=linux GOARCH=amd64 $(MAKE) build

build-linux-arm:
GOOS=linux GOARCH=arm make build
GOOS=linux GOARCH=arm $(MAKE) build

build-linux-arm64:
GOOS=linux GOARCH=arm64 make build
GOOS=linux GOARCH=arm64 $(MAKE) build

build-linux-riscv64:
GOOS=linux GOARCH=riscv64 make build
GOOS=linux GOARCH=riscv64 $(MAKE) build

build-all-netbsd: build-netbsd-386 build-netbsd-amd64 build-netbsd-arm

build-netbsd-386:
GOOS=netbsd GOARCH=386 make build
GOOS=netbsd GOARCH=386 $(MAKE) build

build-netbsd-amd64:
GOOS=netbsd GOARCH=amd64 make build
GOOS=netbsd GOARCH=amd64 $(MAKE) build

build-netbsd-arm:
GOOS=netbsd GOARCH=arm make build
GOOS=netbsd GOARCH=arm $(MAKE) build

build-all-openbsd: build-openbsd-386 build-openbsd-amd64 build-openbsd-arm build-openbsd-arm64

build-openbsd-386:
GOOS=openbsd GOARCH=386 make build
GOOS=openbsd GOARCH=386 $(MAKE) build

build-openbsd-amd64:
GOOS=openbsd GOARCH=amd64 make build
GOOS=openbsd GOARCH=amd64 $(MAKE) build

build-openbsd-arm:
GOOS=openbsd GOARCH=arm make build
GOOS=openbsd GOARCH=arm $(MAKE) build

build-openbsd-arm64:
GOOS=openbsd GOARCH=arm64 make build
GOOS=openbsd GOARCH=arm64 $(MAKE) build

build-all-windows: build-windows-386 build-windows-amd64 build-windows-arm64

build-windows-386:
GOOS=windows GOARCH=386 make build-windows
GOOS=windows GOARCH=386 $(MAKE) build-windows

build-windows-amd64:
GOOS=windows GOARCH=amd64 make build-windows
GOOS=windows GOARCH=amd64 $(MAKE) build-windows

build-windows-arm64:
GOOS=windows GOARCH=arm64 make build-windows
GOOS=windows GOARCH=arm64 $(MAKE) build-windows

.PHONY: build
build:
CGO_ENABLED="0" GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -v \
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -v \
-ldflags "${LD_FLAGS} -X ${REPO}/pkg/version.OS=$(GOOS) -X ${REPO}/pkg/version.Arch=$(GOARCH)" \
-o ${BUILD_DIR}/$(BINARY_NAME)-$(GOOS)-$(GOARCH)

.PHONY: build-windows
build-windows:
CGO_ENABLED="0" GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -v \
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -v \
-ldflags "${LD_FLAGS} -X ${REPO}/pkg/version.OS=$(GOOS) -X ${REPO}/pkg/version.Arch=$(GOARCH)" \
-o ${BUILD_DIR}/$(BINARY_NAME)-$(GOOS)-$(GOARCH).exe

Expand Down
4 changes: 4 additions & 0 deletions bin/prepare_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if [ "$(which zip)" = "" ]; then
fi

# add execution permission
chmod 750 ./build/wakatime-cli-android-arm
chmod 750 ./build/wakatime-cli-android-arm64
chmod 750 ./build/wakatime-cli-freebsd-386
chmod 750 ./build/wakatime-cli-freebsd-amd64
chmod 750 ./build/wakatime-cli-freebsd-arm
Expand All @@ -33,6 +35,8 @@ chmod 750 ./build/wakatime-cli-windows-amd64.exe
chmod 750 ./build/wakatime-cli-windows-arm64.exe

# create archives
zip -j ./release/wakatime-cli-android-arm.zip ./build/wakatime-cli-android-arm
zip -j ./release/wakatime-cli-android-arm64.zip ./build/wakatime-cli-android-arm64
zip -j ./release/wakatime-cli-freebsd-386.zip ./build/wakatime-cli-freebsd-386
zip -j ./release/wakatime-cli-freebsd-amd64.zip ./build/wakatime-cli-freebsd-amd64
zip -j ./release/wakatime-cli-freebsd-arm.zip ./build/wakatime-cli-freebsd-arm
Expand Down