Skip to content

Commit

Permalink
public release CI should now be functional on all 3 major platforms (f…
Browse files Browse the repository at this point in the history
…ixes #1)
  • Loading branch information
samtupy committed Jun 1, 2024
1 parent f169ffc commit ec196a2
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 19 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/public_build.yml

This file was deleted.

113 changes: 113 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: release
on:
workflow_dispatch:

jobs:
mac_build:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: build
run: |
brew install scons
cp build/build_macos.sh .
sudo chmod +x build_macos.sh
./build_macos.sh ci
cd release
tar -czf ../mac_release.tar.gz *
cd ..
curl -u "${{secrets.CIFTP}}" -s -T mac_release.tar.gz ftp://nvgt.gg
linux_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build
run: |
sudo chmod +x build/build_linux.sh
./build/build_linux.sh ci
cd release
tar -czf ../linux_release.tar.gz *
cd ..
curl -u "${{secrets.CIFTP}}" -s -T linux_release.tar.gz ftp://nvgt.gg
windows_build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: build
run: |
pip3 install scons
choco install -y upx
curl -s -O https://nvgt.gg/windev.zip
7z x windev.zip -owindev
scons -s
cd release
tar -czf ../windows_release.tar.gz *
cd ..
curl -u "${{secrets.CIFTP}}" -s -T windows_release.tar.gz ftp://nvgt.gg
windows_package:
runs-on: windows-latest
needs: ["linux_build", "mac_build", "windows_build"]
steps:
- uses: actions/checkout@v4
- name: build
run: |
curl -s -O -u "${{secrets.CIFTP}}" ftp://nvgt.gg/mac_release.tar.gz
curl -s -O -u "${{secrets.CIFTP}}" ftp://nvgt.gg/linux_release.tar.gz
curl -s -O -u "${{secrets.CIFTP}}" ftp://nvgt.gg/windows_release.tar.gz
mkdir linux_release
tar -xzf linux_release.tar.gz -C linux_release
mkdir mac_release
tar -xzf mac_release.tar.gz -C mac_release
tar -xzf windows_release.tar.gz -C release
cd doc
pip3 install -r requirements.txt
cd OSL
python3 make_osl_document.py
cd ..
python3 docgen.py
cd ..
cp linux_release/stub/* release/stub
cp mac_release/stub/* release/stub
cd install
makensis nvgt.nsi
python3 upload_windows_installer.py ${{secrets.CIFTP}}
mac_package:
runs-on: macos-latest
needs: ["linux_build", "mac_build", "windows_build"]
steps:
- uses: actions/checkout@v4
- name: build
run: |
curl -s -O -u "${{secrets.CIFTP}}" ftp://nvgt.gg/mac_release.tar.gz
curl -s -O -u "${{secrets.CIFTP}}" ftp://nvgt.gg/linux_release.tar.gz
curl -s -O -u "${{secrets.CIFTP}}" ftp://nvgt.gg/windows_release.tar.gz
mkdir linux_release
tar -xzf linux_release.tar.gz -C linux_release
mkdir windows_release
tar -xzf windows_release.tar.gz -C windows_release
tar -xzf mac_release.tar.gz -C release
python3 build/ci_set_version.py
cd doc
pip3 install --user -r requirements.txt --break-system-packages
cd OSL
python3 make_osl_document.py
cd ..
python3 docgen.py
cd ..
cp linux_release/stub/* release/stub
cp windows_release/stub/* release/stub
cd install
python3 make_dmg.py ../release ${{secrets.CIFTP}}
final_package:
runs-on: ubuntu-latest
needs: ["windows_package", "mac_package"]
steps:
- uses: actions/checkout@v4
- name: build
run: |
curl -H "X-Auth: ${{secrets.CIPHP}}" -s https://nvgt.gg/ci/release_complete.php?ver=$nvgt_version
9 changes: 9 additions & 0 deletions build/ci_set_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This just sets the nvgt_version github variable for use within CI actions to the format used for binary releases. Any of this structure subject to change.

import os
from pathlib import Path

def get_version_info():
return Path("version").read_text().strip().replace("-", "_")

with open(os.getenv("GITHUB_ENV"), "a") as f: f.write(f"nvgt_version={get_version_info()}\n")
17 changes: 17 additions & 0 deletions install/upload_windows_installer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import ftplib, os, sys
from pathlib import Path

def get_version_info():
return Path("../version").read_text().strip().replace("-", "_")

ftp_creds=sys.argv[1].split(":")
ver = get_version_info()
if ftp_creds:
try:
ftp = ftplib.FTP("nvgt.gg", ftp_creds[0], ftp_creds[1])
f = open(f"nvgt_{ver}.exe", "rb")
ftp.storbinary(f"STOR nvgt_{ver}.exe", f)
f.close()
ftp.quit()
except Exception as e:
print(f"Warning, cannot upload to ftp {e}")
3 changes: 2 additions & 1 deletion src/nvgt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class nvgt_application : public Poco::Util::Application {
#else
virtual int main(const std::vector<std::string>& args) override {
setupCommandLineProperty(args);
g_command_line_args->InsertAt(0, (void*)&config().getString("application.path"));
std::string path_tmp;
g_command_line_args->InsertAt(0, (void*)&path_tmp);
int retcode = Application::EXIT_OK;
if (LoadCompiledExecutable(g_ScriptEngine) < 0 || (retcode = ExecuteScript(g_ScriptEngine, commandName().c_str())) < 0) {
ShowAngelscriptMessages();
Expand Down
2 changes: 1 addition & 1 deletion src/pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ bool load_embedded_packs(Poco::BinaryReader& br) {
return true;
}
void write_embedded_packs(Poco::BinaryWriter& bw) {
bw.write7BitEncoded(embedding_packs.size());
bw.write7BitEncoded(uint32_t(embedding_packs.size()));
for (const auto& p : embedding_packs) {
bw << p.first;
Poco::FileInputStream fs(p.second);
Expand Down
3 changes: 2 additions & 1 deletion src/timestuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using namespace Poco;
Poco::Clock g_clock;
Poco::Timestamp g_secure_clock;
Poco::Timestamp g_time_cache;
Poco::LocalDateTime g_time_values;
Poco::DateTime g_time_values;
Poco::FastMutex g_time_mutex;

static asIScriptContext* callback_ctx = NULL;
Expand Down Expand Up @@ -193,6 +193,7 @@ void update_tm() {
FastMutex::ScopedLock l(g_time_mutex);
g_time_cache = ts;
g_time_values = ts;
g_time_values.makeLocal(Poco::Timezone::tzd());
}

int get_date_year() {
Expand Down
1 change: 1 addition & 0 deletions web/_cobalt.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source: src
destination: public_html
template_extensions: [md, liquid, lphp]

site:
title: The Nonvisual Gaming Toolkit
Expand Down
6 changes: 6 additions & 0 deletions web/src/ci/release_complete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
require "auth.php";
// This copies a couple of release artifacts into the downloads directory.
if (!isset($_GET["ver"])) die("missing version");
echo system("cp ../../ci/nvgt_" . $_GET["ver"] . "* ../downloads");
?>
22 changes: 22 additions & 0 deletions web/src/downloads/index.lphp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
layout: default.liquid
title: Downloads
permalink: /downloads/index.php
---

<h1>Downloads</h1>
<p>This page contains the latest binary releases for NVGT. The page is not currently particularly organized but will be improved soon.</p>

<h2>available files</h2>
<?php
$files = glob("nvgt_*");
if (count($files) < 1) {
echo("<p>no files</p>");
} else {
echo "<ul>\n";
foreach($files as $file) {
echo '<li><a href="' . $file . '">' .$file. '</a></li>';
}
echo "</ul>\n";
}
?>

0 comments on commit ec196a2

Please sign in to comment.