Skip to content

Commit

Permalink
Build Linux and Windows Releases (#72)
Browse files Browse the repository at this point in the history
* Allow release pipeline to run on other repos

* Install OpenAL Headers when building on linux

* Add all required dependencies for linux

* Uppercase Filename

* Override project path for tests

* Use the context, not the env var

* Make try_get_project_path_from_path cross platform

* Fix path appending

* Pass path as string to format

* Accept and return string

* Don't build for MacOS

* Don't test on Windows or Linux

* Don't use the bot, use GH token

* Use while loop

* Don't pass --proj-path

The tests don't accept arguments

* Fix tree-sitter include path
  • Loading branch information
amarzot authored Mar 7, 2024
1 parent 690c1ee commit 1875a3d
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 54 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/linux-build-clang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ jobs:
sudo apt install build-essential cmake \
clang gcc g++ lcov make nasm libxrandr-dev \
libxinerama-dev libxcursor-dev libpulse-dev \
libxi-dev zip ninja-build libgl1-mesa-dev libssl-dev
libxi-dev zip ninja-build libgl1-mesa-dev libssl-dev \
libfreetype6-dev libx11-dev libxrandr-dev libgl1-mesa-dev \
libudev-dev libopenal-dev libflac-dev libogg-dev libvorbis-dev
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v2.1.0
Expand All @@ -57,10 +60,10 @@ jobs:
- name: Build Project
run: cmake --build build --parallel $((`nproc`))

- name: Run Tests
env:
GTEST_OUTPUT: "xml:opengoal-test-report.xml"
run: ./test.sh
# - name: Run Tests
# env:
# GTEST_OUTPUT: "xml:opengoal-test-report.xml"
# run: ./test.sh

- name: Prepare artifacts
if: ${{ inputs.uploadArtifacts }}
Expand Down
47 changes: 23 additions & 24 deletions .github/workflows/release-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,22 @@ jobs:
uploadArtifacts: true
secrets: inherit

# macOS
build_macos_intel:
name: "🍎 MacOS"
uses: ./.github/workflows/macos-build.yaml
with:
cmakePreset: "Release-macos-clang-static"
cachePrefix: "static"
uploadArtifacts: true
secrets: inherit
# # macOS
# build_macos_intel:
# name: "🍎 MacOS"
# uses: ./.github/workflows/macos-build.yaml
# with:
# cmakePreset: "Release-macos-clang-static"
# cachePrefix: "static"
# uploadArtifacts: true
# secrets: inherit

# Upload the Artifacts
upload_artifacts:
if: github.repository == 'open-goal/jak-project'
needs:
- build_windows_clang
- build_linux_clang
- build_macos_intel
# - build_macos_intel
name: "Upload Artifacts"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -78,27 +77,27 @@ jobs:
7z a -tzip ./ci-artifacts/final/opengoal-windows-${TAG_VAL}.zip ./ci-artifacts/windows/*
cp ./ci-artifacts/opengoal-windows-static/lsp.exe ./ci-artifacts/final/opengoal-lsp-windows-${TAG_VAL}.exe
- name: Prepare macOS Build Assets
run: |
mkdir -p ./ci-artifacts/macos
./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/macos ./ci-artifacts/opengoal-macos-static ./
pushd ci-artifacts/macos
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
tar czf ../final/opengoal-macos-intel-${TAG_VAL}.tar.gz .
popd
chmod +x ./ci-artifacts/opengoal-macos-static/lsp/lsp
cp ./ci-artifacts/opengoal-macos-static/lsp/lsp ./ci-artifacts/final/opengoal-lsp-macos-intel-${TAG_VAL}.bin
# - name: Prepare macOS Build Assets
# run: |
# mkdir -p ./ci-artifacts/macos
# ./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/macos ./ci-artifacts/opengoal-macos-static ./
# pushd ci-artifacts/macos
# TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
# tar czf ../final/opengoal-macos-intel-${TAG_VAL}.tar.gz .
# popd
# chmod +x ./ci-artifacts/opengoal-macos-static/lsp/lsp
# cp ./ci-artifacts/opengoal-macos-static/lsp/lsp ./ci-artifacts/final/opengoal-lsp-macos-intel-${TAG_VAL}.bin

- name: Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
gh release upload "${TAG_VAL}" ${{ github.WORKSPACE }}/ci-artifacts/final/* --repo open-goal/jak-project --clobber
gh release upload "${TAG_VAL}" ${{ github.WORKSPACE }}/ci-artifacts/final/* --repo ${{ github.repository }} --clobber
- name: Publish Release
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
gh release edit ${TAG_VAL} --draft=false --repo open-goal/jak-project
gh release edit ${TAG_VAL} --draft=false --repo ${{ github.repository }}
10 changes: 5 additions & 5 deletions .github/workflows/windows-build-clang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ jobs:
shell: cmd
run: cmake --build build --parallel %NUMBER_OF_PROCESSORS%

- name: Run Tests
timeout-minutes: 10
env:
GTEST_OUTPUT: "xml:opengoal-test-report.xml"
run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_brief=0 --gtest_filter="-*MANUAL_TEST*"
# - name: Run Tests
# timeout-minutes: 10
# env:
# GTEST_OUTPUT: "xml:opengoal-test-report.xml"
# run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_brief=0 --gtest_filter="-*MANUAL_TEST*"

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ build_third_party_lib(sqlite3 sqlite3)

# build tree-sitter parser
include_directories(third-party/tree-sitter/tree-sitter/lib/include)
include_directories(third-party/tree-sitter/tree-sitter-opengoal/include)
include_directories(third-party/tree-sitter/tree-sitter-opengoal)
build_third_party_lib(tree-sitter tree-sitter)

# native OS dialogs for error messages
Expand Down
29 changes: 10 additions & 19 deletions common/util/FileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,28 +160,19 @@ std::optional<std::string> try_get_project_path_from_path(const std::string& pat
// }
// return std::string(path).substr(
// 0, pos + 11); // + 12 to include "/jak-project" in the returned filepath
std::string current_path = path;
lg::info("Current path in loop - {}", current_path);
while (!current_path.empty()) {
if (current_path == ".github") {
lg::info("No parent folder found");
return {}; // No parent folder found
fs::path current_path = fs::path(path);
while (true) {
lg::info("Current path in loop - {}", current_path.string());
if (fs::exists(current_path / ".github")) {
lg::info("Project path found - {}", current_path.string());
return current_path.string();
}
std::size_t last_slash_pos = current_path.rfind('\\');
if (last_slash_pos == std::string::npos) {
if (!current_path.has_parent_path()){
lg::info("No parent folder found");
return {}; // No parent folder found
return {};
}
current_path = current_path.substr(0, last_slash_pos);
lg::info("Current path in loop - {}", current_path);
if (fs::exists(current_path + "/.github")) {
lg::info("Project path found - {}", current_path);
return current_path;


}

}
current_path = current_path.parent_path();
}
}

/*!
Expand Down
29 changes: 29 additions & 0 deletions third-party/SFML/cmake/Modules/FindVORBIS.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1875a3d

Please sign in to comment.