From dc5e95e4c02be1078adf35ae633870e79d823415 Mon Sep 17 00:00:00 2001 From: Load Accumulator Date: Thu, 2 Nov 2023 17:24:55 +0100 Subject: [PATCH] [META/ADD] Start writing actions/workflows. --- .gitea/actions/setup-build/action.yml | 21 ++++++++++ .gitea/actions/setup-build/setup | 60 +++++++++++++++++++++++++++ .gitea/workflows/test-push.yaml | 24 +++++++++++ 3 files changed, 105 insertions(+) create mode 100644 .gitea/actions/setup-build/action.yml create mode 100755 .gitea/actions/setup-build/setup create mode 100644 .gitea/workflows/test-push.yaml diff --git a/.gitea/actions/setup-build/action.yml b/.gitea/actions/setup-build/action.yml new file mode 100644 index 0000000..670d511 --- /dev/null +++ b/.gitea/actions/setup-build/action.yml @@ -0,0 +1,21 @@ +name: Setup a basic build environment +description: Setup a basic build environment with a proper SSL library + +inputs: + compiler: + description: Compiler used for setting up everything + required: false + default: gcc + ssl: + description: SSL library used for Cytoplasm later on + required: false + default: openssl + +outputs: + compiler: + description: Compiler binary + value: '${{ steps.install.outputs.compiler }}' + +runs: + - run: 'setup "${{ runner.os }}" "${{inputs.compiler}}" "${{inputs.ssl}}"' + shell: bash diff --git a/.gitea/actions/setup-build/setup b/.gitea/actions/setup-build/setup new file mode 100755 index 0000000..82131e6 --- /dev/null +++ b/.gitea/actions/setup-build/setup @@ -0,0 +1,60 @@ +#!/bin/bash + +COMPILER=$2 +SSL=$3 + +DISTRO=$(grep -E '^NAME=' /etc/os-release | + cut -d'=' -f2 | + tr -d '"') + +# Installs a package using the native OS's package manager. +install_pkg() { + case $DISTRO in + "Ubuntu") + "Debian GNU/Linux" ) + apt install -y $1 + ;; + "Arch Linux" ) + pacman -Syu --noconfirm $1 + ;; + esac +} + +install_compiler() { + echo '::group::Setting up a compiler' + case $DISTRO in + "Ubuntu" ) + "Debian GNU/Linux" ) + install_pkg build-essential + [ $COMPILER = 'clang' ] && install_pkg clang + + CC=gcc + [ $COMPILER = 'clang' ] && CC=clang + ;; + "Arch Linux" ) + install_pkg $COMPILER make + CC=gcc + [ $COMPILER = 'clang' ] && CC=clang + esac + echo '::endgroup::' +} +install_ssl() { + echo '::group::Setting up SSL' + case $DISTRO in + "Ubuntu" ) + "Debian GNU/Linux" ) + # Doesn't seem like Debian got LibreSSL + [ $SSL = 'libressl' ] && echo "::error ::LibreSSL is not on Debian" + install_pkg openssl + ;; + "Arch Linux" ) + install_pkg $SSL + esac + echo '::endgroup::' +} + +# Install the compiler and SSL +install_compiler +install_ssl + +echo "compiler=$CC" >> "$GITHUB_OUTPUT" diff --git a/.gitea/workflows/test-push.yaml b/.gitea/workflows/test-push.yaml new file mode 100644 index 0000000..554268a --- /dev/null +++ b/.gitea/workflows/test-push.yaml @@ -0,0 +1,24 @@ +name: Testing pushed commits +run-name: "Testing pushed changes (HEAD@${{ github.head_ref }}) on ${{ runner.os }}" +on: [push] + +jobs: + # Compiles out everything. + compile-all: + # TODO: More architectures + runs-on: ubuntu-latest + steps: + # Setups a basic build environment. + - name: Setup build environment + uses: ./.gitea/actions/setup-build + + # TODO + # Compile out Cytoplasm + #- name: Compiles Cytoplasm + # uses: ./.gitea/actions/build-latest-cytoplasm + + # Finally, builds out Telodendria with everything. + #- name: Compiles Telodendria + # uses: ./.gitea/actions/build-telodendria + +