Skip to content

Commit

Permalink
use multiarch CI build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
iofq authored and neolynx committed Sep 18, 2024
1 parent 18736d6 commit 8b28908
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 57 deletions.
62 changes: 48 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
DEBIAN_FRONTEND: noninteractive

jobs:
build:
test:
name: "System Tests (Ubuntu 22.04)"
runs-on: ubuntu-22.04
continue-on-error: false
Expand Down Expand Up @@ -98,9 +98,9 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt

ci-debian:
ci-debian-build:
name: "CI Build"
needs: build
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -185,17 +185,20 @@ jobs:
run: |
./upload-artifacts.sh release ${{ matrix.suite }}
ci-other:
name: "CI Build (FreeBSD, MacOS, Linux)"
needs: build
ci-release-build:
name: "CI Build (Binary)"
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, freebsd, darwin]
goarch: ["386", "amd64", "arm", "arm64"]
exclude:
- goos: darwin
goarch: 386
- goos: darwin
goarch: arm
steps:
- name: "Install packages"
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends make ca-certificates git curl devscripts
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: "Checkout repository"
uses: actions/checkout@v3
with:
Expand All @@ -212,9 +215,40 @@ jobs:
with:
go-version: ${{ steps.goversion.outputs.GOVER }}

- name: "Build goxc packages"
- name: "Build packages for ${{ matrix.goos }} ${{ matrix.goarch }}"
env:
GOBIN: /usr/local/bin
run: |
mkdir -p tmp/man tmp/completion/bash_completion.d tmp/completion/zsh/vendor-completions
go version
make release
echo ${{ github.ref_name }} > VERSION
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o tmp/aptly -ldflags='-extldflags=-static'
cp man/aptly.1 tmp/man/
cp completion.d/aptly tmp/completion/bash_completion.d/
cp completion.d/_aptly tmp/completion/zsh/vendor-completions/
gzip tmp/man/aptly.1
path="aptly_${{ matrix.goos }}_${{ matrix.goarch }}"
mkdir -p $path
mv tmp "$path"
zip -r "$path" . -i "$path/*"
- uses: actions/upload-artifact@v4
with:
name: aptly_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: aptly_${{ matrix.goos }}_${{ matrix.goarch }}.zip

gh-release:
name: "Github Release: ${{ github.ref_name }}"
runs-on: ubuntu-latest
continue-on-error: false
needs: ci-release-build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: out/
- name: Release
uses: softprops/action-gh-release@v2
with:
files: "out/**/aptly_*.zip"
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ root/
man/aptly.1.html
man/aptly.1.ronn

.goxc.local.json

system/env/

# created by make build for release artifacts
Expand Down
18 changes: 0 additions & 18 deletions .goxc.json

This file was deleted.

24 changes: 1 addition & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ prepare: ## Install go module dependencies
go mod tidy -v
go generate

dev:
PATH=$(BINPATH)/:$(PATH)
go get github.com/laher/goxc
go install github.com/laher/goxc

check: system/env
ifeq ($(RUN_LONG_TESTS), yes)
system/env/bin/flake8
Expand Down Expand Up @@ -88,23 +83,6 @@ mem.png: mem.dat mem.gp
gnuplot mem.gp
open mem.png

goxc: dev
rm -rf root/
mkdir -p root/usr/share/man/man1/ root/etc/bash_completion.d/ root/usr/share/zsh/vendor-completions/
cp man/aptly.1 root/usr/share/man/man1
cp completion.d/aptly root/etc/bash_completion.d/
cp completion.d/_aptly root/usr/share/zsh/vendor-completions/
gzip root/usr/share/man/man1/aptly.1
GOPATH=$(PWD)/.go go generate
GOPATH=$(PWD)/.go goxc -pv=$(VERSION) -max-processors=4 $(GOXC_OPTS)

release: GOXC_OPTS=-tasks-=go-vet,go-test,rmbin
release: goxc
rm -rf build/
mkdir -p build/
mv xc-out/$(VERSION)/aptly_$(VERSION)_* build/
ls -l build/

man: ## Create man pages
make -C man

Expand Down Expand Up @@ -153,4 +131,4 @@ clean: ## remove local build and module cache
test -d .go/ && chmod u+w -R .go/ && rm -rf .go/ || true
rm -rf build/ docs/ obj-*-linux-gnu*

.PHONY: help man prepare version release goxc docker-build-aptly-dev docker-system-tests docker-unit-tests docker-lint docker-build build docker-aptly clean
.PHONY: help man prepare version release docker-build-aptly-dev docker-system-tests docker-unit-tests docker-lint docker-build build docker-aptly clean

0 comments on commit 8b28908

Please sign in to comment.