Skip to content

Commit

Permalink
First release of greenion
Browse files Browse the repository at this point in the history
  • Loading branch information
JSpiesser committed Nov 28, 2024
0 parents commit 9ed7eec
Show file tree
Hide file tree
Showing 335 changed files with 64,648 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build-linux-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh

set -eux

OUTPUT_DIR="$(pwd)/output"
RUNTIME_DEPENDENCIES=

case "$MATRIX_VERSION" in
ubuntu-22.04)
export DEPENDS_LIBAVUTIL=libavutil56
export DEPENDS_LIBAVCODEC=libavcodec58
;;
ubuntu-24.04)
export DEPENDS_LIBAVUTIL=libavutil58
export DEPENDS_LIBAVCODEC=libavcodec60
;;
*)
echo TODO: add runtime dependencies versions in the build script for $MATRIX_VERSION
exit 1
;;
esac

if ! command -v rustup ; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="$PATH:~/.cargo/bin/"
fi

echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake \
dpkg-dev \
ffmpeg \
g++ \
libasound2-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
libclang-dev \
libdbus-1-dev \
libkrb5-dev \
libpam0g-dev \
libx264-dev \
libx264-dev \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxdamage-dev \
libxext-dev \
nfpm \
protobuf-compiler \
protobuf-compiler \
x264 \
xcb \

mkdir "$OUTPUT_DIR"

cargo --color always build --manifest-path sanzu/Cargo.toml --release
cargo --color always build --manifest-path greenion-agents/Cargo.toml --release --bin greenion-client
cargo --color always build --manifest-path greenion-agents/Cargo.toml --release --bin greenion-server

nfpm package --config packaging/nfpm_server.yaml --packager deb --target "$OUTPUT_DIR/Greenion-Server_amd64-$MATRIX_VERSION.deb"
nfpm package --config packaging/nfpm_client.yaml --packager deb --target "$OUTPUT_DIR/Greenion-Client_amd64-$MATRIX_VERSION.deb"
43 changes: 43 additions & 0 deletions .github/workflows/build-windows-executables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

set -e

if ! command -v rustup ; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="$PATH:~/.cargo/bin/"
fi

rustup target add x86_64-pc-windows-gnu
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
mingw-w64 \
cmake \
nasm \
libclang-dev \
protobuf-compiler \
librust-clang-sys-dev \
wixl \

cargo install --force --locked bindgen-cli

OUTPUT_DIR="$(pwd)/output"

mkdir -p "$OUTPUT_DIR/agent"
mkdir "$OUTPUT_DIR/default_config"

cd greenion-agents

cargo --color always build --target x86_64-pc-windows-gnu --release
cp target/x86_64-pc-windows-gnu/release/*.exe "$OUTPUT_DIR/agent/"

wget https://github.com/qarnot/sanzu/releases/download/sanzu-qarnot-v0.1.4/sanzu-windows-qarnot-v0.1.4.zip
unzip sanzu-windows-qarnot-v0.1.4.zip
unzip -d "$OUTPUT_DIR/sanzu_zip" sanzu-windows-release/sanzu-0.1.4-x86_64-pc-windows-gnu.zip

# TODO: stop regenerating certs
(cd certs/ && ./script.sh)

cp -r config/default/*/* "$OUTPUT_DIR/default_config/"
cp certs/rootCA.crt "$OUTPUT_DIR"
cp installer/server/GreenionServerInstaller.wxs "$OUTPUT_DIR"
cp installer/client/GreenionClientInstaller.wxs "$OUTPUT_DIR"
9 changes: 9 additions & 0 deletions .github/workflows/build-windows-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -ex

# either 'Server' or 'Client'
KIND=$1

candle "Greenion${KIND}Installer.wxs"
light "Greenion${KIND}Installer.wixobj" -sval
71 changes: 71 additions & 0 deletions .github/workflows/linux-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: build and test linux packages

permissions:
contents: write

on:
push:
pull_request:

jobs:
build-linux-packages:
strategy:
matrix:
version: [22.04, 24.04]
runs-on: ubuntu-${{ matrix.version }}
steps:
- uses: actions/checkout@v4
- name: Clone sanzu fork
run: git clone --depth=1 https://github.com/qarnot/sanzu
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
sanzu/target/
greenion-agents/target/
key: ${{ runner.os }}-${{ matrix.version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build and package for linux
run: |
export MATRIX_VERSION=ubuntu-${{ matrix.version }}
bash .github/workflows/build-linux-packages.sh
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: ubuntu-${{ matrix.version }}
path: ./output/Greenion-*.deb
if-no-files-found: error
test-linux:
needs: build-linux-packages
strategy:
matrix:
version: [22.04, 24.04]
runs-on: ubuntu-${{ matrix.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ubuntu-${{ matrix.version }}
path: ./greenion-agents/tests/installers/
- name: Test proxy
run: timeout 300 sudo bash ./greenion-agents/tests/run.sh
- name: Fix permissions for cache
run: sudo chmod -R 666 ./greenion-agents/tests/target/

release-linux:
if: startsWith(github.ref, 'refs/tags/')
needs: test-linux
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: ubuntu-*
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
Greenion-*.deb
81 changes: 81 additions & 0 deletions .github/workflows/windows-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: build and test windows installer

permissions:
contents: write

on:
push:
pull_request:

jobs:
build-windows-executables:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
greenion-agents/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build windows executables
run: source .github/workflows/build-windows-executables.sh
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: Windows-Executables
path: ./output
if-no-files-found: error
build-windows-installer:
needs: build-windows-executables
runs-on: ubuntu-latest
strategy:
matrix:
kind: [Server, Client]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: Windows-Executables
- run: chmod -R 777 . # there is probably a better way to give docker access to the current folder
- name: Build windows installers
run: |
docker run -v .:/wix dactiv/wix .github/workflows/build-windows-installer.sh ${{ matrix.kind }}
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: Windows-${{ matrix.kind }}-Installer
path: ./Greenion${{ matrix.kind }}Installer.msi
if-no-files-found: error
test-windows:
needs: build-windows-installer
strategy:
matrix:
version: [2019, 2022, latest]
runs-on: windows-${{ matrix.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ./greenion-agents/tests/installers/
merge-multiple: true
- name: Test proxy
shell: bash
run: bash ./greenion-agents/tests/run.windows.sh
release-windows:
if: startsWith(github.ref, 'refs/tags/')
needs: test-windows
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
Greenion*.msi
Loading

0 comments on commit 9ed7eec

Please sign in to comment.