This commit is contained in:
tim
2024-05-30 11:43:38 -04:00
parent 78babc2e08
commit b04e762a0a
28 changed files with 88 additions and 207 deletions
+17 -44
View File
@@ -14,45 +14,12 @@ defaults:
shell: c:/PROGRA~1/Git/usr/bin/bash.exe --noprofile --norc -e -o pipefail {0}
# shell: c:\Program Files\Git\usr\bin\bash.exe --noprofile --norc -e -o pipefail {0}
# shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail {0}
env:
BASH_ENV: ${{ github.workspace }}\SHELL.env
jobs:
# generate-bin:
# runs-on: windows-2022
# steps:
# - uses: humbletim/firestorm-gha/actions-node-script@tpv-gha-nunja
# if: false
# - uses: actions/cache@v4
# if: false
# - name: SHELL.env
# run: source /d/a/_actions/humbletim/firestorm-gha/tpv-gha-nunja/_gha-inline.sh
#
# - name: postflight tests
# run: |
# set -Euo pipefail
# echo cache_id=$cache_id
# echo "PATH='$PATH'"
# jq --version
# python3 --version
#
# - name: Populate local bin
# uses: ./fsvr-action
# with:
# run: . $gha_fsvr_dir/gha-populate-bin.sh && gha-populate-bin-windows
#
# - name: ~000 Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: failure() && fromJSON(inputs.fstuple).pause != 'never'
# with:
# limit-access-to-actor: true
windows-build:
# if: true
# needs: generate-bin
runs-on: windows-2022
steps:
- uses: humbletim/firestorm-gha/actions-node-script@tpv-gha-nunja
- uses: humbletim/firestorm-gha/gha-node20-run@tpv-gha-nunja
if: false
- uses: actions/upload-artifact@v4
if: false
@@ -67,27 +34,34 @@ jobs:
- name: ~Clone
run: |
source /d/a/_actions/humbletim/firestorm-gha/tpv-gha-nunja/_gha-inline.sh
echo BASH_ENV=$(cygpath -ma SHELL.env) | tee -a $GITHUB_ENV
mkdir -pv env.d bin bin/pystuff cache repo build
echo cache_id=$(echo "$base-$repo" | sed 's@[^-a-zA-Z0-9_.]@-@g') | tee -a env.d/local.env
source $GITHUB_ENV
source $BASH_ENV
source $gha_fsvr_dir/util/gha.quiet-clone.bash
source $ghash/gha.quiet-clone.bash
quiet-clone github.com ${GITHUB_REPOSITORY} ${GITHUB_REF_NAME} fsvr
echo fsvr_dir=$PWD/fsvr | tee -a $GITHUB_ENV
(
echo fsvr_dir=$PWD/fsvr
echo 'function fsvr_step() {( set -Euo pipefail; $fsvr_dir/util/build.sh "$@" ; )} ; declare -xf fsvr_step'
) | tee -a env.d/local.env
- name: Generate gha-bootstrap.env
run: |
source $gha_fsvr_dir/gha-bootstrap.sh
source $gha_fsvr_dir/gha-bootstrap.bash
get_bootstrap_vars | tee env.d/gha-bootstrap.env || exit 127
- name: Populate local bin
uses: ./fsvr-action
with:
run: . $gha_fsvr_dir/gha-populate-bin.sh && gha-populate-bin-windows
run: . $gha_fsvr_dir/gha-populate-bin.bash && gha-populate-bin-windows
- name: Expand Source Repositories
uses: ./fsvr-action
with:
run: |
source $gha_fsvr_dir/util/gha.cachette.bash
source $gha_fsvr_dir/util/gha.quiet-clone.bash
source $ghash/gha.cachette.bash
source $ghash/gha.quiet-clone.bash
echo "[sourcing] $nunja_dir/000.bash" >&2
. $nunja_dir/000.bash $hub $repo "$ref"
@@ -139,7 +113,6 @@ jobs:
| cache_id | $cache_id |
| hostname | `hostname` |
$repos
# $tools
| --------- | ----------- |
EOF
@@ -148,7 +121,7 @@ jobs:
with:
run: |
set -Euo pipefail
source $gha_fsvr_dir/util/gha.cachette.bash
source $ghash/gha.cachette.bash
declare -a msvcs=(build/msvc.env build/msvc.nunja.env build/msvc_path.env)
gha-cache-restore-fast "$cache_id-msvc-a" "$(echo "${msvcs[@]}" | tr ' ' '\n')" || (
@@ -165,7 +138,7 @@ jobs:
with:
run: |
set -Euo pipefail
source $gha_fsvr_dir/util/gha.cachette.bash
source $ghash/gha.cachette.bash
gha-cache-restore-fast $cache_id-openvr-d "cache/openvr-**" || (
source $fsvr_dir/openvr/improvise.bash
provision_openvr "$fsvr_cache_dir" || _die "openvr/improvise failed"
@@ -183,7 +156,7 @@ jobs:
with:
run: |
set -Euo pipefail
source $gha_fsvr_dir/util/gha.cachette.bash
source $ghash/gha.cachette.bash
gha-cache-restore-fast $cache_id-build-packages-c build/packages || (
source $gha_fsvr_dir/util/reconstitute-dependencies.bash
manifest=$build_dir/packages-info.json
+3 -7
View File
@@ -3,8 +3,9 @@ set -Euo pipefail
test -v GITHUB_ACTIONS || { echo "GITHUB_ACTIONS expected" >&2 ; exit 3 ; }
# /d/a/_actions/humbletim/firestorm-gha/tpv-gha-nunja
export gha_fsvr_dir=$(readlink -f $(dirname "${BASH_SOURCE}"))
source $gha_fsvr_dir/util/gha.ht-ln.bash
ht-ln $gha_fsvr_dir/actions-node-script ./fsvr-action
export ghash=$gha_fsvr_dir/gha
source $ghash/gha.ht-ln.bash
ht-ln $gha_fsvr_dir/gha-node20-run ./fsvr-action
export PATH="$PATH:/c/ProgramData/Chocolatey/bin"
jq '.inputs.fstuple|fromjson' $GITHUB_EVENT_PATH \
@@ -13,10 +14,5 @@ jq '.inputs.fstuple|fromjson' $GITHUB_EVENT_PATH \
source $GITHUB_ENV
export workspace=${GITHUB_WORKSPACE:-${workspace:-$PWD}}
function to-id() { cat | sed 's@[^-a-zA-Z0-9_.]@-@g' ; }
mkdir -pv env.d bin bin/pystuff cache repo build
echo cache_id=$(echo "$base-$repo" | to-id) | tee -a env.d/local.env
$gha_fsvr_dir/gha-generate-shell-env.sh | tee -a SHELL.env
@@ -1,7 +1,7 @@
#!/bin/bash
function make-stub() {(
CC=${CC:-'/c/Program Files/LLVM/bin/clang'}
CC=${CC:-'/c/Program Files/LLVM/bin/clang'}
# CC=${CC:-'/c/mingw64/bin/gcc'}
set -x
local here=$(dirname "$BASH_SOURCE")
@@ -13,7 +13,7 @@ function make-stub() {(
function make-echo-exe() {(
local output="$1" message="$2"
# CC=${CC:-'/c/mingw64/bin/gcc'}
CC=${CC:-'/c/Program Files/LLVM/bin/clang'}
CC=${CC:-'/c/Program Files/LLVM/bin/clang'}
set -x
echo '
#include <stdio.h>
@@ -39,10 +39,10 @@ function make-echo-exe() {(
# # # local body="$(fsvr/util/_utils.sh __getenv 'BASH_FUNC__alias_exe_tmp%%' | sed 's@^() @@')"
# # # body="$(echo "$body" | jq -sR | sed 's@[$]@\\$@g;' )"
# # # body="$(echo "$body" | sed -e 's@\\n\"@\"@g;' )"
# # # echo "BASH_FUNC_${name}=${body}" | command -p tee -a $GITHUB_ENV
# # # echo "BASH_FUNC_${name}=${body}" | command -p tee -a $GITHUB_ENV
# # # echo --------------------------
# # )
# # )
# # declare -xf ${name} ; declare -fp ${name} ; env | grep ${name}" | command -p tee -a $GITHUB_ENV
# # echo "BASH_FUNC_${name}()($@)" | command -p tee -a $GITHUB_ENV
# fsvr/util/_utils.sh ht-ln bin/BASH_FUNC_invoke.exe bin/$name.exe
# }
# }
@@ -42,21 +42,3 @@ function get_bootstrap_vars() {(
echo fsvr_cache_dir=${fsvr_cache_dir:-$pwd/cache}
)}
function gha_steps() {
local fsvr_dir=$(dirname $BASH_SOURCE)
PATH=$PATH:bin
yaml2json < $fsvr_dir/.github/workflows/CompileWindows.yml | jq -r '.jobs[].steps|to_entries[]|select(.value.name and ((.value.name//"")|startswith("~")|not))|.value.name+" # "+(.key|tostring)'
}
function gha_step() {
local fsvr_dir=$(dirname $BASH_SOURCE)
PATH=$PATH:bin
if [[ "$1" =~ ^[0-9a-f][0-9a-f][0-9a-f]$ ]]; then
yaml2json < $fsvr_dir/.github/workflows/CompileWindows.yml | jq -r --arg prefix "$1" '.jobs[].steps[]|select((.name//"")|startswith($prefix))|"# "+.name+"\n"+(.with.run//.run)'
elif [[ "$1" =~ ^[0-9]+$ ]]; then
yaml2json < $fsvr_dir/.github/workflows/CompileWindows.yml | jq -r --argjson name "$1" '.jobs[].steps[$name]|"# "+.name+"\n"+(.with.run//.run)'
else
yaml2json < $fsvr_dir/.github/workflows/CompileWindows.yml | jq -r --arg name "$1" '.jobs[].steps[]|select(.name==$name)|"# "+.name+"\n"+(.with.run//.run)'
fi
}
@@ -4,7 +4,6 @@ set -Euo pipefail
_PRESHELL_PATH="${_PRESHELL_PATH:-}"
PATH="$PATH:/usr/bin"
#fsvr_dir="${fsvr_dir:-$PWD/fsvr}"
gha_fsvr_dir="$(dirname "${BASH_SOURCE}")"
_hostname="windows-2022"
@@ -29,6 +28,7 @@ pysite="$(PYTHONUSERBASE="$_PYTHONUSERBASE" python3 -msite --user-site)"
######################################################################
echo "$(cat<<EOF
export gha_fsvr_dir="$gha_fsvr_dir"
export ghash="$ghash"
_PRESHELL_PATH="$_PRESHELL_PATH"
_PATH="$_PATH"
@@ -51,7 +51,7 @@ declare -x PYTHONOPTIMIZE=nonemptystring
function _err() { local rc=\$1 ; shift; echo "[_err rc=\$rc] \$@" >&2; return \$rc; }
function ht-ln() { '$gha_fsvr_dir/util/_utils.sh' ht-ln "\$@" ; }
function ht-ln() {( source "$ghash/gha.ht-ln.bash" && ht-ln "\$@" )}
function hostname(){ echo '$_hostname' ; }
function tee() { TEE="`which tee`" "`which python3`" "$gha_fsvr_dir/util/tee.py" "\$@" ; }
function colout() { $(
@@ -75,9 +75,7 @@ function jq() { "`which jq`" $(
) ; }
function envsubst() { "`which envsubst`" "\$@" ; }
function fsvr_step() {( set -Euo pipefail; \$fsvr_dir/util/build.sh "\$@" ; )}
declare -xf _err tee parallel ht-ln hostname colout jq envsubst fsvr_step
declare -xf _err tee parallel ht-ln hostname colout jq envsubst
# set -Eo pipefail
EOF
)"
@@ -1,6 +1,6 @@
// helper to invoke a script in full node20 actions environment
// -- humbletim 2024.03.13
const child_process = require('child_process');
var {
@@ -22,7 +22,7 @@ const shells = {
msys2: process.env.GHCUP_MSYS2 ? `${process.env.GHCUP_MSYS2}\\usr\\bin\\bash.exe` : 'msys2',
};
var cmd = shells[shell] ? `"${shells[shell]}" --noprofile --norc -e -o pipefail {0}` : shell;
var exe;
var args = cmd
.replace(/^"([^\"]+)" |^([^ ]+) /, (_, a, b) => { exe=a || b; return ''; })
@@ -60,7 +60,7 @@ var options = {
delete options.env['*'];
var tmp = JSON.parse(JSON.stringify(options));
if (parsedEnv['*'] !== 'none') tmp.env = '{ /* inherit process.env + parsed */ }';
if (parsedEnv['*'] !== 'none') tmp.env = '{ /* inherit process.env + parsed */ }';
if (process.env.DEBUG) console.debug('PARSED_', { exe: exe, args: JSON.stringify(args), options: tmp, forwardEnv: Object.keys(forwardEnv).length, parsedEnv: parsedEnv });
const bash = child_process.spawn(exe, args, options );
@@ -94,28 +94,3 @@ function parseKeyValueString(input) {
return result;
}
// console.log(parseKeyValueString("keyx=\"a value with spaces\" key2=value2 squot='c:\\Program Files' ekey=a\\ value\\ with\\ slashspaces anotherkey=complexvalue=weird other=\"embedded=\\\"super complex\\\"\""))
// process.exit(1);
// process.stdin.pipe(bash.stdin);
// bash.stdout.pipe(process.stdout);
// bash.stderr.pipe(process.stderr);
// var reps={};
// var n=0;
// function absorb(_, value) {
// var key = `__xx__${n++}`;
// reps[key]= value;
// return ' '+key;
// }
// // handle escaped chars
// shell = ` ${shell} `;
// console.log('before', shell)
// shell = shell.replace(/ "((?:[^"]+|\\")+)"/g, absorb);
// shell = shell.replace(/ ((?:[^ ]+\\ [^ ]+)+)/g, absorb)
// var args = shell.split(/ +/)
// .map((x)=> x in reps ? reps[x] : x)
// .filter((x)=> x !== '');
// console.log('reps', reps)
@@ -3,7 +3,7 @@
function get_ninja-windows() {(
set -Euo pipefail
local archive=$( $fsvr_dir/util/_utils.sh wget-sha256 \
local archive=$( wget-sha256 \
bbde850d247d2737c5764c927d1071cbb1f1957dcabda4a130fa8547c12c695f \
https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip \
.
@@ -25,7 +25,7 @@ function get_colout() {(
function get_parallel() {(
set -Euo pipefail
local archive=$( $fsvr_dir/util/_utils.sh wget-sha256 \
local archive=$( wget-sha256 \
3f9a262cdb7ba9b21c4aa2d6d12e6ccacbaf6106085fdaafd3b8a063e15ea782 \
https://mirror.msys2.org/msys/x86_64/parallel-20231122-1-any.pkg.tar.zst \
.
@@ -48,7 +48,7 @@ function get_parallel() {(
# yaml2json < fsvr/.github/workflows/CompileWindows.yml | jq '.jobs[].steps[]| "#"+.name+"\n"+.if+"\n"+(.run // .with.run)' -r
function get_yaml2json-windows() {(
set -Euo pipefail
local archive=$( $fsvr_dir/util/_utils.sh wget-sha256 \
local archive=$( wget-sha256 \
a73fb27e36e30062c48dc0979c96afbbe25163e0899f6f259b654d56fda5cc26 \
https://github.com/bronze1man/yaml2json/releases/download/v1.3/yaml2json_windows_amd64.exe\
.
@@ -62,10 +62,11 @@ function gha-populate-bin-windows() {(
test -d "$fsvr_dir" || exit 50
test -n "$cache_id" || exit 51
source $fsvr_dir/util/gha.cachette.bash
source $ghash/gha.cachette.bash
source $ghash/gha.ht-ln.bash
function generate_BASH_FUNC_invoke() {
source $fsvr_dir/bashland/gha.alias-exe.bash
source $gha_fsvr_dir/bashland/BASH_FUNC/gha.alias-exe.bash
BASH=$(cygpath -was $BASH) make-stub bin/BASH_FUNC_invoke.exe || return 90
}
@@ -75,7 +76,7 @@ function gha-populate-bin-windows() {(
)
{
$fsvr_dir/util/_utils.sh ht-ln bin/BASH_FUNC_invoke.exe bin/ht-ln.exe
ht-ln bin/BASH_FUNC_invoke.exe bin/ht-ln.exe
ht-ln bin/BASH_FUNC_invoke.exe bin/hostname.exe
ht-ln bin/BASH_FUNC_invoke.exe bin/jq.exe
ht-ln bin/BASH_FUNC_invoke.exe bin/envsubst.exe
@@ -94,9 +95,8 @@ function gha-populate-bin-windows() {(
function xxprovision_tools() {(
set -Euo pipefail
source $fsvr_dir/gha-bootstrap.sh
source $fsvr_dir/util/gha.wget-sha256.bash
source $fsvr_dir/util/gha.literally-exists.bash
source $ghash/gha.wget-sha256.bash
source $ghash/gha.literally-exists.bash
pysite="$(cygpath -m "$(python3 -msite --user-site)")"
literally-exists bin/ninja.exe || get_ninja-windows || exit `_err $? "failed to provision ninja $?"`
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
function gha_steps() {(
local workspace=$(dirname $BASH_SOURCE)
PATH=$PATH:bin
yaml2json < $workspace/.github/workflows/CompileWindows.yml | jq -r '.jobs[].steps|to_entries[]|select(.value.name and ((.value.name//"")|startswith("~")|not))|.value.name+" # "+(.key|tostring)'
)}
function gha_step() {(
local workspace=$(dirname $BASH_SOURCE)
PATH=$PATH:bin
if [[ "$1" =~ ^[0-9a-f][0-9a-f][0-9a-f]$ ]]; then
yaml2json < $workspace/.github/workflows/CompileWindows.yml | jq -r --arg prefix "$1" '.jobs[].steps[]|select((.name//"")|startswith($prefix))|"# "+.name+"\n"+(.with.run//.run)'
elif [[ "$1" =~ ^[0-9]+$ ]]; then
yaml2json < $workspace/.github/workflows/CompileWindows.yml | jq -r --argjson name "$1" '.jobs[].steps[$name]|"# "+.name+"\n"+(.with.run//.run)'
else
yaml2json < $workspace/.github/workflows/CompileWindows.yml | jq -r --arg name "$1" '.jobs[].steps[]|select(.name==$name)|"# "+.name+"\n"+(.with.run//.run)'
fi
)}
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
if ! cygpath . >/dev/null 2>/dev/null ; then
test ! -v DEBUG || echo "[$BASH_SOURCE] emulating cygpath $OSTYPE" >&2
function cygpath() {
case "$1" in
-pm) echo "'$1' / -pm not yet implemented... '$2'" >&2 ; exit 89 ;;
-*p*) echo "'$1' / -p not yet implemented... '$2'" >&2 ; exit 90 ;;
-*a*) shift ; readlink -f "$1" ;;
-*m*) shift ; readlink -m "$1" ;;
-*) echo "'$1' not yet implemented... '$2'" >&2 ; exit 90 ;;
*) readlink "$1" ;;
esac
}
fi
+5
View File
@@ -8,5 +8,10 @@
"copyright": "$viewer_source_url",
"name": "_repo_viewer",
"version": "$version_full"
},
"_build": {
"copyright": "",
"name": "$GHA_REPORT",
"version": "$build_id"
}
}
+4 -6
View File
@@ -2,12 +2,10 @@
# fsvr script utilities -- humbletim 2024.03.08
_fsvr_utils_dir=$(readlink -f $(dirname "$BASH_SOURCE"))
source $_fsvr_utils_dir/gha.reduce-paths.bash
source $_fsvr_utils_dir/gha.wget-sha256.bash
source $_fsvr_utils_dir/gha.ht-ln.bash
source $_fsvr_utils_dir/gha.cygpath.bash
source $ghash/gha.reduce-paths.bash
source $ghash/gha.wget-sha256.bash
source $ghash/gha.ht-ln.bash
source $ghash/gha.cygpath.bash
_dbgopts='set -Euo pipefail'
+5 -7
View File
@@ -1,12 +1,10 @@
#!/bin/bash
require_here=`readlink -f $(dirname $BASH_SOURCE)`
function require() { source $require_here/$@ ; }
require _utils.sh
source _utils.sh
require gha.load-level.bash
require gha.upload-artifact.bash
require gha.cachette.bash
source $ghash/gha.load-level.bash
source $ghash/gha.upload-artifact.bash
source $ghash/gha.cachette.bash
_assert "root_dir" 'test -d "$root_dir"'
_assert "build_dir" 'test -d "$build_dir"'
@@ -76,7 +74,7 @@ function 020_perform_replacements() {( $_dbgopts;
ht-ln $fsvr_dir/newview/cmake_pch.cxx $build_dir/newview/
if [[ $viewer_id == blackdragon ]] ; then
source $gha_fsvr_dir/bashland/gha.alias-exe.bash
source $gha_fsvr_dir/bashland/BASH_FUNC/gha.alias-exe.bash
make-echo-exe "$build_dir/newview/BDVersionChecker.exe" "TODO: newview/BDVersionChecker.exe" || exit 67
test -x "$build_dir/newview/BDVersionChecker.exe" || exit 68
fi
-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
# create variables with git commit short hashes from checkout folders
# -- humbletim 2024.03.08
source `dirname $BASH_SOURCE`/_utils.sh # for _setenv, _die
test -n "$*" || _die 'usage: $0 [varname=gitdir] [varname2=gitdir2] ...'
# example:
# ./util/generate_git_vars.sh source_sha=. openvr_sha=../openvr
#
# # which exports environment vars and emits on stdout:
# source_sha=a1b2c3d
# openvr_sha=9f8e7d6
# git active commit short hash for a checkout folder
function _git_sha() {
local path="$1"
[[ "$path" =~ /[.]git ]] && path="$(dirname "$path")"
test -e "$path" || return `_err $? "could not determine .git root from $1"`
git -C "$path" describe --always --first-parent --abbrev=7 || return `_err $? "could not describe '$path'"`
}
set -e
for kv in $* ; do
k=${kv/=*/}
v=${kv/*=/}
_setenv $k=`_git_sha $v`
done
-20
View File
@@ -1,20 +0,0 @@
#!/bin/bash
set -e
source $(dirname $BASH_SOURCE)/_utils.sh
test -d "$1" || _die "usage: \$ [env workspace=...] generate_path_vars.sh [build_dir]"
root_dir=${root_dir:-${workspace:-${GITHUB_WORKSPACE}}}
build_dir=$1
test -d "$root_dir" || _die "(root_dir='$root_dir') env workspace or GITHUB_WORKSPACE expected as base"
test -d "$build_dir" || _die "build_dir=$build_dir does not exist"
_setenv_extant root_dir=`_realpath $root_dir`
_setenv_extant build_dir=`_realpath $build_dir`
_setenv_extant source_dir=${source_dir:-$root_dir/indra}
_setenv packages_dir=${packages_dir:-$build_dir/packages}
test -d "$build_dir" || _usage "build_dir"
test -d "$root_dir" || _usage "root_dir"
#test -e $root_dir/.git || { echo "!$root_dir/.git" ; exit 1; }
#test -e $_fsvr_dir/.git || { echo "!$_fsvr_dir/.git" ; exit 1; }
-15
View File
@@ -1,15 +0,0 @@
#!/bin/bash
set -e
source $(dirname "$BASH_SOURCE")/_utils.sh
viewer_version=$1
test $(echo "$1" | grep -Eo '[.]' | wc -l) == 3 || _die "expected x.y.z.w got '$1'"
_setenv viewer_version=$viewer_version
_setenv version_major=` _ver_split $viewer_version 1`
_setenv version_minor=` _ver_split $viewer_version 2`
_setenv version_patch=` _ver_split $viewer_version 3`
_setenv version_release=`_ver_split $viewer_version 4`
_setenv version_xyz=$version_major.$version_minor.$version_patch
_setenv version_xyzw=$version_xyz.$version_release
_setenv slos_version=$viewer_version
-13
View File
@@ -1,13 +0,0 @@
#!/bin/bash
if ! cygpath . >/dev/null 2>/dev/null ; then
test ! -v DEBUG || echo "[$BASH_SOURCE] emulating cygpath $OSTYPE" >&2
function cygpath() {
case "$1" in
-*p*) echo "'$1' / -p not yet implemented..." >&2 ; exit 89 ;;
-*a*) shift ; readlink -f "$1" ;;
-*) shift ; readlink -m "$1" ;;
*) readlink "$1" ;;
esac
}
fi