Skip to content

Commit

Permalink
CI: build deb/rpm for arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
drakkan committed Nov 7, 2020
1 parent 4edb9cd commit bf2b252
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ jobs:
$DATE_TIME = ([datetime]::Now.ToUniversalTime().toString("yyyy-MM-ddTHH:mm:ssZ")) | Out-String
go build -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/version.date=$DATE_TIME" -o sftpgo.exe
- name: Gather cross build info
id: cross_info
if: ${{ matrix.upload-coverage && startsWith(matrix.os, 'ubuntu-') }}
run: |
GIT_COMMIT=$(git describe --always)
BUILD_DATE=$(date -u +%FT%TZ)
echo ::set-output name=sha::${GIT_COMMIT}
echo ::set-output name=created::${BUILD_DATE}
- name: Build with xgo
if: ${{ matrix.upload-coverage && startsWith(matrix.os, 'ubuntu-') }}
uses: crazy-max/ghaction-xgo@v1
with:
dest: cross
prefix: sftpgo
targets: linux/arm64
v: true
x: false
race: false
ldflags: -s -w -X github.com/drakkan/sftpgo/version.commit=${{ steps.cross_info.outputs.sha }} -X github.com/drakkan/sftpgo/version.date=${{ steps.cross_info.outputs.created }}
buildmode: default

- name: Run test cases using SQLite provider
run: go test -v -p 1 -timeout 10m ./... -coverprofile=coverage.txt -covermode=atomic

Expand Down Expand Up @@ -86,6 +108,7 @@ jobs:
./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
./sftpgo gen man -d output/man/man1
gzip output/man/man1/*
cp cross/sftpgo-linux-arm64 output/ || :
- name: Prepare build artifact for Windows
if: startsWith(matrix.os, 'windows-')
Expand Down Expand Up @@ -127,6 +150,34 @@ jobs:
name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-x86_64-rpm
path: pkgs/dist/rpm/*

- name: Build Linux Packages arm64
id: build_linux_pkgs_arm64
if: ${{ matrix.upload-coverage && startsWith(matrix.os, 'ubuntu-') }}
run: |
cp cross/sftpgo-linux-arm64 .
cd pkgs
rm -rf dist
./build.sh
PKG_VERSION=$(cat dist/version)
echo "::set-output name=pkg-version::${PKG_VERSION}"
env:
NFPM_ARCH: arm64
BIN_SUFFIX: -linux-arm64

- name: Upload Debian Package arm64
if: ${{ matrix.upload-coverage && startsWith(matrix.os, 'ubuntu-') }}
uses: actions/upload-artifact@v2
with:
name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-arm64-deb
path: pkgs/dist/deb/*

- name: Upload RPM Package arm64
if: ${{ matrix.upload-coverage && startsWith(matrix.os, 'ubuntu-') }}
uses: actions/upload-artifact@v2
with:
name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-arm64-rpm
path: pkgs/dist/rpm/*

test-postgresql-mysql:
name: Test with PostgreSQL/MySQL
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions pkgs/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

NFPM_VERSION=1.9.0

NFPM_ARCH=${NFPM_ARCH:-amd64}
if [ -z ${SFTPGO_VERSION} ]
then
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
Expand Down Expand Up @@ -30,11 +30,11 @@ $BASE_DIR/sftpgo gen man -d man1

cat >nfpm.yaml <<EOF
name: "sftpgo"
arch: "amd64"
arch: "${NFPM_ARCH}"
platform: "linux"
version: ${VERSION}
release: 1
section: "default"
section: "net"
priority: "extra"
maintainer: "Nicola Murino <[email protected]>"
provides:
Expand All @@ -48,7 +48,7 @@ vendor: "SFTPGo"
homepage: "https://github.com/drakkan/sftpgo"
license: "GPL-3.0"
files:
${BASE_DIR}/sftpgo: "/usr/bin/sftpgo"
${BASE_DIR}/sftpgo${BIN_SUFFIX}: "/usr/bin/sftpgo"
./sftpgo-completion.bash: "/usr/share/bash-completion/completions/sftpgo"
./man1/*: "/usr/share/man/man1/"
${BASE_DIR}/init/sftpgo.service: "/lib/systemd/system/sftpgo.service"
Expand Down

0 comments on commit bf2b252

Please sign in to comment.