Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
hollowaykeanho committed Aug 13, 2023
1 parent 158d59c commit f5281d1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 28 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: GitHub CI on Push
run-name: Run the repo development environment across all OSes for main, staging/next branches.
on:
push:
branches: [ main, staging, next ]
jobs:
run-on-linux-debian:
runs-on: debian-latest
steps:
- uses: actions/checkout@v3
- run: . ./ci.cmd setup
run-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- run: .\ci.cmd setup
run-on-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: . ./ci.cmd setup
16 changes: 0 additions & 16 deletions .github/workflows/setup.yml

This file was deleted.

36 changes: 24 additions & 12 deletions ci.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo >/dev/null # >nul & GOTO WINDOWS & rem ^
# Unix Main Codes #
################################################################################
# (1) make sure is by sourcing initialization
if [ "$BASH_SOURCE" == "$(command -v $0)" ]; then
if [ "$BASH_SOURCE" = "$(command -v $0)" ]; then
printf "[ ERROR ] - Source me instead! -> $ . ./start.cmd\n"
exit 1
fi
Expand All @@ -25,7 +25,7 @@ fi

# (2) determine os
PROJECT_OS="$(uname)"
export PROJECT_OS="${PROJECT_OS,,}"
export PROJECT_OS="$(echo "$PROJECT_OS" | tr '[:upper:]' '[:lower:]')"
case "${PROJECT_OS}" in
windows*|ms-dos*)
export EDM_OS='windows'
Expand All @@ -51,7 +51,7 @@ esac

# (3) determine arch
PROJECT_ARCH="$(uname -m)"
export PROJECT_ARCH="${PROJECT_ARCH,,}"
export PROJECT_ARCH="$(echo "$PROJECT_ARCH" | tr '[:upper:]' '[:lower:]')"
case "${PROJECT_ARCH}" in
i686-64)
export EDM_ARCH='ia64' # Intel Itanium.
Expand Down Expand Up @@ -94,7 +94,7 @@ while [ "$pathing" != "" ]; do
fi

# stop the scan if the previous pathing is the same as current
if [ "$previous" == "$pathing" ]; then
if [ "$previous" = "$pathing" ]; then
printf "[ ERROR ] unable to detect repo root directory from PWD.\n"
return 1
break
Expand All @@ -116,7 +116,7 @@ fi
old_IFS="$IFS"
while IFS= read -r line; do
line="${line%%#*}"
if [ "$line" == "" ]; then
if [ "$line" = "" ]; then
continue
fi

Expand Down Expand Up @@ -232,7 +232,7 @@ return 0
::##############################################################################
:: Windows Main Codes #
::##############################################################################
@echo OFF
@echo off
setlocal enabledelayedexpansion
set code=0

Expand All @@ -243,9 +243,14 @@ for /F "skip=1 delims=" %%A in ('wmic cpu get architecture') do (
)

:check_architecture
set "PROJECT_ARCH=!PROJECT_ARCH:~0,-1!"
set "PROJECT_ARCH=!PROJECT_ARCH: =!"
IF "!PROJECT_ARCH!"=="x86" (
set PROJECT_ARCH=i386
set "PROJECT_ARCH=i386"
goto check_type
) ELSE IF "!PROJECT_ARCH!"=="9" (
echo "NOTE: GitHub Action Windows Server detected. Simulating amd64 CPU."
set "PROJECT_ARCH=amd64"
) ELSE IF "!PROJECT_ARCH!"=="64" (
for /F "skip=1 delims=" %%P in ('wmic cpu get name') do (
set "PROJECT_ARCH=%%P"
Expand All @@ -259,20 +264,26 @@ IF "!PROJECT_ARCH!"=="x86" (

:check_type
IF "!PROJECT_ARCH:~0,4!"=="ARM " (
set PROJECT_ARCH=arm64
set "PROJECT_ARCH=arm64"
) ELSE (
set PROJECT_ARCH=amd64
set "PROJECT_ARCH=amd64"
)

:set_os
set "PROJECT_OS=windows"

:scan_root_directory
set "PROJECT_PWD=%CD%"
for /r "%PROJECT_PWD%" %%d in (.) do (
set "PROJECT_ROOT=%%d"
if exist "!PROJECT_ROOT!\.git\config" (
set "PROJECT_PATH_ROOT=%%d"
if exist "!PROJECT_PATH_ROOT!\.git\config" (
if "%PROJECT_PATH_ROOT:~-1%"=="." (
set "PROJECT_PATH_ROOT=%PROJECT_PATH_ROOT:~0,-1%"
)
goto parse_config_file
)

if "!PROJECT_ROOT!"=="%CD%" (
if "!PROJECT_PATH_ROOT!"=="%CD%" (
echo "[ ERROR ] unable to detect repo root directory from PWD.\n"
set code=1
set PROJECT_ARCH= PROJECT_OS= PROJECT_PATH_PWD= PROJECT_PATH_ROOT=
Expand All @@ -281,6 +292,7 @@ for /r "%PROJECT_PWD%" %%d in (.) do (
)

:parse_config_file
echo "DEBUG: !PROJECT_ARCH! !PROJECT_PWD! !PROJECT_PATH_ROOT! !PROJECT_OS!"
if not exist "%PROJECT_ROOT%\CONFIG.toml" (
echo "[ ERROR ] unable to locate CONFIG.toml file.\n"
set code=1
Expand Down

0 comments on commit f5281d1

Please sign in to comment.