Skip to content

Commit

Permalink
Merge pull request #25 from DefGuard/cross-platform-builds
Browse files Browse the repository at this point in the history
feat: build target freebsd
  • Loading branch information
teon authored Jul 28, 2023
2 parents 1e314b9 + 0ee00a5 commit 3562758
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
strategy:
fail-fast: false
matrix:
build: [linux, linux-arm]
build: [linux, linux-arm, freebsd]
include:
- build: linux
os: self-hosted
Expand All @@ -78,6 +78,10 @@ jobs:
os: self-hosted
asset_name: defguard-gateway-linux-armv7
target: armv7-unknown-linux-gnueabihf
- build: freebsd
os: self-hosted
asset_name: defguard-gateway-freebsd-x86_64
target: x86_64-unknown-freebsd
steps:
# Store the version, stripping any v-prefix
- name: Write release version
Expand Down Expand Up @@ -172,14 +176,14 @@ jobs:
asset_content_type: application/octet-stream

- name: Build freebsd package
if: matrix.build == 'linux'
if: matrix.build == 'freebsd'
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/sbin/defguard-gateway defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service example-config.toml=/etc/defguard/gateway.toml"
fpm_opts: "--debug -t freebsd --version=${{ env.VERSION }} -p defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.txz"

- name: Upload freebsd
if: matrix.build == 'linux'
if: matrix.build == 'freebsd'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
16 changes: 14 additions & 2 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/defguard/cross:x86_64-unknown-linux-gnu"
pre-build = ["apt-get update && apt-get install --assume-yes unzip ",
"PB_REL='https://github.com/protocolbuffers/protobuf/releases'",
"PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
"unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr"]

[target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/defguard/cross:armv7-unknown-linux-gnueabihf"
pre-build = ["apt-get update && apt-get install --assume-yes unzip ",
"PB_REL='https://github.com/protocolbuffers/protobuf/releases'",
"PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
"unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr"]

[target.x86_64-unknown-freebsd]
pre-build = ["apt-get update && apt-get install --assume-yes unzip ",
"PB_REL='https://github.com/protocolbuffers/protobuf/releases'",
"PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
"unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr"]

0 comments on commit 3562758

Please sign in to comment.