mirror of
https://github.com/hyprwm/hyprlang.git
synced 2024-11-17 02:25:59 +01:00
CI: Add arch cross-compile and test (#1)
This commit is contained in:
parent
97bf10facd
commit
d6bb511810
3 changed files with 75 additions and 1 deletions
71
.github/workflows/arch.yml
vendored
Normal file
71
.github/workflows/arch.yml
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
name: Build & Test (Arch)
|
||||||
|
|
||||||
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
jobs:
|
||||||
|
gcc:
|
||||||
|
name: "gcc build / clang test"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: archlinux
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository actions
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
sparse-checkout: .github/actions
|
||||||
|
|
||||||
|
- name: Get required pkgs
|
||||||
|
run: |
|
||||||
|
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
|
||||||
|
pacman --noconfirm --noprogressbar -Syyu
|
||||||
|
pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang
|
||||||
|
|
||||||
|
- name: Build with gcc
|
||||||
|
run: |
|
||||||
|
CC="/usr/bin/gcc" CXX="/usr/bin/g++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
|
||||||
|
CC="/usr/bin/gcc" CXX="/usr/bin/g++" cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||||
|
cp ./build/libhyprlang.so /usr/lib
|
||||||
|
|
||||||
|
- name: Build with clang
|
||||||
|
run: |
|
||||||
|
rm -rf ./build
|
||||||
|
CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
|
||||||
|
CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||||
|
rm ./build/libhyprlang.so
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd ./tests && ../build/hyprlang_test
|
||||||
|
|
||||||
|
clang:
|
||||||
|
name: "clang build / gcc test"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: archlinux
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository actions
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
sparse-checkout: .github/actions
|
||||||
|
|
||||||
|
- name: Get required pkgs
|
||||||
|
run: |
|
||||||
|
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
|
||||||
|
pacman --noconfirm --noprogressbar -Syyu
|
||||||
|
pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang
|
||||||
|
|
||||||
|
- name: Build with clang
|
||||||
|
run: |
|
||||||
|
CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
|
||||||
|
CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||||
|
cp ./build/libhyprlang.so /usr/lib
|
||||||
|
|
||||||
|
- name: Build with gcc
|
||||||
|
run: |
|
||||||
|
rm -rf ./build
|
||||||
|
CC="/usr/bin/gcc" CXX="/usr/bin/g++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
|
||||||
|
CC="/usr/bin/gcc" CXX="/usr/bin/g++" cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||||
|
rm ./build/libhyprlang.so
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd ./tests && ../build/hyprlang_test
|
|
@ -39,7 +39,7 @@ CConfig::CConfig(const char* path) {
|
||||||
|
|
||||||
impl->envVariables.clear();
|
impl->envVariables.clear();
|
||||||
for (char** env = environ; *env; ++env) {
|
for (char** env = environ; *env; ++env) {
|
||||||
const std::string ENVVAR = *env;
|
const std::string ENVVAR = *env ? *env : "";
|
||||||
const auto VARIABLE = ENVVAR.substr(0, ENVVAR.find_first_of('='));
|
const auto VARIABLE = ENVVAR.substr(0, ENVVAR.find_first_of('='));
|
||||||
const auto VALUE = ENVVAR.substr(ENVVAR.find_first_of('=') + 1);
|
const auto VALUE = ENVVAR.substr(ENVVAR.find_first_of('=') + 1);
|
||||||
impl->envVariables.push_back({VARIABLE, VALUE});
|
impl->envVariables.push_back({VARIABLE, VALUE});
|
||||||
|
|
|
@ -52,6 +52,9 @@ int main(int argc, char** argv, char** envp) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (!getenv("SHELL"))
|
||||||
|
setenv("SHELL", "/bin/sh", true);
|
||||||
|
|
||||||
std::cout << "Starting test\n";
|
std::cout << "Starting test\n";
|
||||||
|
|
||||||
Hyprlang::CConfig config("./config/config.conf");
|
Hyprlang::CConfig config("./config/config.conf");
|
||||||
|
|
Loading…
Reference in a new issue