Skip to content

Commit

Permalink
Implement new CI based on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael-santiago committed Jan 16, 2025
1 parent 6b0637b commit a629975
Show file tree
Hide file tree
Showing 13 changed files with 566 additions and 51 deletions.
45 changes: 0 additions & 45 deletions .circleci/config.yml

This file was deleted.

203 changes: 203 additions & 0 deletions .github/workflows/forge-specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
on: push
name: Kryptos CI
jobs:
Linux-GCC:
runs-on: ubuntu-latest
steps:
- name: Clone kryptos repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install basic tools
shell: bash
run: sh src/build/ci/linux/install-basic-tools.sh
- name: Install Hefesto
shell: bash
run: sh src/build/ci/linux/install-hefesto.sh
- name: Run kryptos forge (GCC)
shell: bash
run: |
cd src
sudo -E hefesto --mk-samples --toolset=gcc
Linux-Clang:
runs-on: ubuntu-latest
steps:
- name: Clone kryptos repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install basic tools
shell: bash
run: sh src/build/ci/linux/install-basic-tools.sh
- name: Install Hefesto
shell: bash
run: sh src/build/ci/linux/install-hefesto.sh
- name: Run kryptos forge (Clang)
shell: bash
run: |
cd src
sudo -E hefesto --mk-samples --toolset=clang
FreeBSD-Clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: FreeBSD Forge
uses: vmactions/freebsd-vm@v1
with:
sync: rsync
copyback: false
prepare: |
pkg install -y sudo git llvm
usesh: true
run: |
. src/build/ci/freebsd/install-hefesto.sh
cd src
sudo -E hefesto --mk-samples --toolset=clang
cd .. && sudo rm -rf kryptos
FreeBSD-GCC:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: FreeBSD Forge
uses: vmactions/freebsd-vm@v1
with:
sync: rsync
copyback: false
prepare: |
pkg install -y sudo git lang/gcc
usesh: true
run: |
. src/build/ci/freebsd/install-hefesto.sh
cd src
sudo -E hefesto --mk-samples --toolset=gcc
cd .. && sudo rm -rf kryptos
NetBSD-GCC:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: NetBSD Forge
uses: vmactions/netbsd-vm@v1
with:
sync: rsync
copyback: false
prepare: |
/usr/sbin/pkg_add sudo git gcc*
shell: bash
run: |
. src/build/ci/netbsd/install-hefesto.sh
cd src
sudo -E hefesto --mk-samples --toolset=gcc
cd .. && sudo rm -rf kryptos
NetBSD-Clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: NetBSD Forge
uses: vmactions/netbsd-vm@v1
with:
sync: rsync
copyback: false
prepare: |
/usr/sbin/pkg_add sudo git clang*
shell: bash
run: |
. src/build/ci/netbsd/install-hefesto.sh
cd src
sudo -E hefesto --mk-samples --toolset=clang
cd .. && sudo rm -rf kryptos
OpenBSD-Clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: OpenBSD Forge
uses: vmactions/openbsd-vm@v1
with:
sync: rsync
copyback: false
prepare: |
pkg_add sudo-1.9.15.5p0 git-2.46.1 llvm-17.0.6p12
usesh: true
run: |
. src/build/ci/netbsd/install-hefesto.sh
cd src
sudo -E hefesto --mk-samples --toolset=clang
cd .. && sudo rm -rf kryptos
OpenBSD-GCC:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: OpenBSD Forge
uses: vmactions/openbsd-vm@v1
with:
sync: rsync
copyback: false
prepare: |
pkg_add sudo-1.9.15.5p0 git-2.46.1 gcc-11.2.0p14 gcc-libs-11.2.0p14
usesh: true
run: |
. src/build/ci/netbsd/install-hefesto.sh
ln -sf `which egcc` /usr/bin/gcc
cd src
sudo -E hefesto --mk-samples --toolset=gcc
cd .. && sudo rm -rf kryptos
Windows-GCC:
runs-on: windows-latest
steps:
- name: Clone kryptos repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install Hefesto
shell: cmd
run: |
src\build\ci\windows\install-hefesto.bat && RefreshEnv.cmd && hefesto --version
- name: Run kryptos forge
shell: cmd
run: |
RefreshEnv.cmd && cd src && hefesto --toolset=gcc --mk-samples
Windows-MSVC:
runs-on: windows-latest
steps:
- name: Clone kryptos repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install Hefesto
shell: cmd
run: |
src\build\ci\windows\install-hefesto.bat && RefreshEnv.cmd && hefesto --version
- name: Run kryptos forge
shell: cmd
run: |
choco install -y visualstudio2022buildtools --package-parameters "--includeRecommended --includeOptional --add Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64 --passive --locale en-US"
choco install -y visualstudio2022-workload-vctools --package-parameters "--includeRecommended --add Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64 --passive"
dir "%ProgramFiles%\Microsoft Visual Studio 14.0\VC"
dir "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC"
RefreshEnv.cmd && cd src && hefesto --toolset=msvc --mk-samples
# Windows-Clang:
# runs-on: windows-latest
# steps:
# - name: Clone kryptos repo
# uses: actions/checkout@v3
# with:
# submodules: true
# - name: Install Hefesto
# shell: cmd
# run: |
# src\build\ci\windows\install-hefesto.bat && RefreshEnv.cmd && hefesto --version
# - name: Run kryptos forge
# shell: cmd
# run: |
# RefreshEnv.cmd && cd src && hefesto --toolset=clang --mk-samples
58 changes: 52 additions & 6 deletions src/Toolsets.hsl
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,36 @@ local function runbkcmd(cmd type string) : result type int {
result hefesto.sys.run($cmd);
}

local function get_versioned_vs_folder() : result type string {
var cwd type string;
$cwd = hefesto.sys.pwd();
var root_lookup type list;
$root_lookup.add_item("C:\\Program Files\\");
$root_lookup.add_item("C:\\Program Files (x86)\\");
var r type int;
$r = 0;
while ($r < $root_lookup.count()) {
var curr_root type string;
$curr_root = $root_lookup.item($r);
if (hefesto.sys.cd("C:\\Program Files\\")) {
var dirs type list;
$dirs = lsdir();
hefesto.sys.cd($cwd);
var d type int;
$d = 0;
while ($d < $dirs.count()) {
var curr_path type string;
$curr_path = $dirs.item($d);
if ($curr_path.match("Microsoft Visual Studio [0-9]+\\.[0-9]+")) {
result $curr_path;
}
$d = $d + 1;
}
}
}
result "";
}

local function get_vcvarsall_path() : result type string {
var program_files type list;
$program_files.add_item("Program Files (x86)");
Expand All @@ -328,10 +358,20 @@ local function get_vcvarsall_path() : result type string {
$vsinstall_type.add_item("Professional");
$vsinstall_type.add_item("Enterprise");

var metapaths type list;

var metapath type string;

$metapath = "C:\\{{PROGRAMFILES}}\\Microsoft Visual Studio\\{{YEAR}}\\{{VSINSTALLTYPE}}\\VC\\Auxiliary\\Build\\vcvarsall.bat";

$metapaths.add_item($metapath);

$metapath = get_versioned_vs_folder();
if ($metapath.len() > 0) {
$metapath = hefesto.sys.make_path($metapath, "\\VC\\Auxiliary\\Build\\varsall.bat");
$metapaths.add_item($metapath);
}

var y type int;
var p type int;
var v type int;
Expand All @@ -349,12 +389,18 @@ local function get_vcvarsall_path() : result type string {
var curr_vsinstall_type type string;
$curr_vsinstall_type = $vsinstall_type.item($v);
var vcvarsall_path type string;
$vcvarsall_path = $metapath;
$vcvarsall_path.replace("\\{\\{PROGRAMFILES\\}\\}", $curr_program_files);
$vcvarsall_path.replace("\\{\\{YEAR\\}\\}", $curr_year);
$vcvarsall_path.replace("\\{\\{VSINSTALLTYPE\\}\\}", $curr_vsinstall_type);
if (isfile($vcvarsall_path)) {
result $vcvarsall_path;
var m type int;
$m = 0;
while ($m < $metapaths.count()) {
$metapath = $metapaths.item($m);
$vcvarsall_path = $metapath;
$vcvarsall_path.replace("\\{\\{PROGRAMFILES\\}\\}", $curr_program_files);
$vcvarsall_path.replace("\\{\\{YEAR\\}\\}", $curr_year);
$vcvarsall_path.replace("\\{\\{VSINSTALLTYPE\\}\\}", $curr_vsinstall_type);
if (isfile($vcvarsall_path)) {
result $vcvarsall_path;
}
$m = $m + 1;
}
$v = $v + 1;
}
Expand Down
19 changes: 19 additions & 0 deletions src/build/ci/freebsd/install-hefesto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/bash

#
# Copyright (C) 2025 by Rafael Santiago
#
# This is a free software. You can redistribute it and/or modify under
# the terms of the GNU General Public License version 2.
#
#

git clone https://github.com/rafael-santiago/hefesto --recursive
cd hefesto/src
printf "\n" > blau.txt
sudo ./build.sh < blau.txt
HEFESTO_INCLUDES_HOME="/usr/local/share/hefesto/include"; export HEFESTO_INCLUDES_HOME
HEFESTO_MODULES_HOME="/usr/local/share/hefesto/module"; export HEFESTO_MODULES_HOME
sudo chown -R $USER /usr/local/share/hefesto
cd ../..
rm -rf hefesto
3 changes: 3 additions & 0 deletions src/build/ci/linux/deps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
git
gcc-9
clang
19 changes: 19 additions & 0 deletions src/build/ci/linux/install-basic-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/bash

#
# Copyright (C) 2025 by Rafael Santiago
#
# This is free software. You can redistribute it and or/modify under
# the terms of the GNU General Public License version 2.
#
#


deps_file=$(dirname $0)/deps.txt

sudo apt-get update

for dep in `cat $deps_file`
do
sudo apt-get install -y $dep
done
19 changes: 19 additions & 0 deletions src/build/ci/linux/install-hefesto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/bash

#
# Copyright (C) 2025 by Rafael Santiago
#
# This is a free software. You can redistribute it and/or modify under
# the terms of the GNU General Public License version 2.
#
#

git clone https://github.com/rafael-santiago/hefesto --recursive
cd hefesto/src
printf "\n" > blau.txt
sudo ./build.sh < blau.txt
echo "HEFESTO_INCLUDES_HOME=/usr/local/share/hefesto/include" >> "$GITHUB_ENV"
echo "HEFESTO_MODULES_HOME=/usr/local/share/hefesto/module" >> "$GITHUB_ENV"
sudo chown -R $USER /usr/local/share/hefesto
cd ../..
rm -rf hefesto
Loading

0 comments on commit a629975

Please sign in to comment.