use multiarch CI build for release

This commit is contained in:
iofq
2024-09-14 23:06:36 -05:00
committed by André Roth
parent ba2c86361d
commit 5e86a0b9e6
4 changed files with 49 additions and 57 deletions

View File

@@ -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
@@ -93,9 +93,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
@@ -180,17 +180,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:
@@ -207,9 +210,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
.gitignore vendored
View File

@@ -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

View File

@@ -1,18 +0,0 @@
{
"AppName": "aptly",
"ArtifactsDest": "xc-out/",
"TasksExclude": [
"rmbin",
"go-test",
"go-vet"
],
"ResourcesInclude": "README.rst,LICENSE,AUTHORS,man/aptly.1",
"BuildConstraints": "linux,386 linux,amd64 linux,arm linux,arm64 darwin,amd64 freebsd,386 freebsd,amd64",
"MainDirsExclude": "_man,vendor",
"BuildSettings": {
"LdFlagsXVars": {
"Version": "main.Version"
}
},
"ConfigVersion": "0.9"
}

View File

@@ -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
@@ -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
@@ -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