-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub actions windows build #71
Merged
Adamcake
merged 6 commits into
Adamcake:master
from
Jacoby6000:github-actions-windows-build
Oct 7, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e1e4de3
Set up workflow for windows builds and releases
Jacoby6000 1357614
disable windows release publishing
Jacoby6000 ed3f9d7
Separate luajit cache/restore to avoid building it multiple times aft…
Jacoby6000 0f8d713
fix cef version usage
Jacoby6000 7820efd
Remove redundant cef step
Jacoby6000 7572d29
Remove some whitespace, test new CEF setup
Jacoby6000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- master # Automatically build on push to master | ||
pull_request: | ||
branches: | ||
- master # Automatically build on pull request to master | ||
release: | ||
types: | ||
- published # Automatically build and publish artifacts on release (gated behind ENABLE_WINDOWS_RELEASES) | ||
|
||
env: | ||
CEF_VERSION: '114.0.5735.199' | ||
LUAJIT_VERSION: '2.1' | ||
ENABLE_WINDOWS_RELEASES: 'false' | ||
|
||
jobs: | ||
build-windows-project: | ||
name: Build Project | ||
runs-on: windows-2022 | ||
steps: | ||
- name: Checkout Project | ||
uses: actions/checkout@v4.2.0 | ||
with: | ||
path: Bolt | ||
submodules: recursive | ||
|
||
- name: Add msbuild to PATH | ||
uses: microsoft/setup-msbuild@v2 | ||
with: | ||
vs-version: 17.0 | ||
|
||
- uses: ilammy/msvc-dev-cmd@v1.13.0 | ||
with: | ||
arch: x64 | ||
|
||
- name: Setup cmake | ||
uses: jwlawson/actions-setup-cmake@v2 | ||
with: | ||
cmake-version: '3.30.x' | ||
|
||
- name: Create Directories | ||
run: | | ||
mkdir cef | ||
|
||
- name: Restore LuaJIT from Cache | ||
id: restore-cache-luajit | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: LuaJIT | ||
key: 'windows-luajit-${{ env.LUAJIT_VERSION }}' | ||
|
||
- name: Checkout LuaJIT | ||
if: steps.restore-cache-luajit.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v4.2.0 | ||
with: | ||
path: LuaJIT | ||
repository: LuaJIT/LuaJIT | ||
ref: v${{ env.LUAJIT_VERSION }} | ||
|
||
- name: Build LuaJIT | ||
if: steps.restore-cache-luajit.outputs.cache-hit != 'true' | ||
run: | | ||
cd LuaJIT/src | ||
.\msvcbuild.bat | ||
|
||
- name: Save LuaJIT to Cache | ||
if: steps.restore-cache-luajit.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: LuaJIT | ||
key: 'windows-luajit-${{ env.LUAJIT_VERSION }}' | ||
|
||
- name: Restore CEF from Cache | ||
id: restore-cef-cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: Bolt\cef\dist | ||
key: 'windows-cef-${{ env.CEF_VERSION }}' | ||
|
||
- name: Download CEF | ||
if: steps.restore-cef-cache.outputs.cache-hit != 'true' | ||
run: | | ||
Invoke-WebRequest -Uri 'https://adamcake.com/cef/cef-${{ env.CEF_VERSION }}-windows64-minimal-ungoogled.zip' -OutFile 'cef.zip' | ||
Expand-Archive -Path 'cef.zip' -DestinationPath 'cef' | ||
Copy-Item -Path (Get-ChildItem -Path "cef" -Directory | Select-Object -First 1).FullName -Destination "Bolt\cef\dist" -Recurse | ||
|
||
- name: Save CEF to Cache | ||
if: steps.restore-cef-cache.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: Bolt\cef\dist | ||
key: 'windows-cef-${{ env.CEF_VERSION }}' | ||
|
||
# At this point the file tree looks like | ||
# D:\a\Bolt\Bolt | ||
# - LuaJIT | ||
# - <whole luaJIT source> | ||
# - Bolt | ||
# - <whole Bolt source> | ||
# - cef | ||
# - dist | ||
# - <CEF release distribution> | ||
# | ||
# The tree has many nested Bolt dirs because of how GHA works. | ||
# The first two Bolt dirs (D:\a\Bolt\Bolt) are the workspace provided by github. | ||
# Github always does it this way. | ||
# Then github normally clones directly in to the workspace with a folder of the repo name. | ||
# However for our usecase we clone multiple repos, so we have D:\a\Bolt\Bolt\{LuaJIT, Bolt} | ||
- name: Build Project | ||
uses: threeal/cmake-action@v2.0.0 | ||
with: | ||
source-dir: Bolt # The directory where CMakeLists.txt is located | ||
build-dir: build # Makes it so that the build directory is set to Bold/build | ||
generator: Visual Studio 17 | ||
options: | | ||
BOLT_LUAJIT_DIR=D:\a\Bolt\Bolt\LuaJIT\src | ||
CMAKE_BUILD_TYPE=Release | ||
BOLT_CEF_INSTALLDIR=D:\a\Bolt\Bolt\install-location | ||
build-args: --config Release -j 4 | ||
|
||
# Installs to D:\a\Bolt\Bolt\install-location\bolt-launcher\* | ||
- name: Create Release | ||
run: cmake --install build/ | ||
|
||
# Uploads D:\a\Bolt\Bolt\install-location as a zip | ||
# With `bolt-launcher` as the root directory of the zip file | ||
- name: Upload Build Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Bolt-Windows-${{ github.sha }} | ||
path: D:\a\Bolt\Bolt\install-location | ||
|
||
# Uploads the zip file to the release matching the format of the above step | ||
# Such that build artifacts and release artifacts are the same | ||
- name: Attach Bolt Artifact to Release | ||
if: github.event_name == 'release' && env.ENABLE_WINDOWS_RELEASES == 'true' | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
# In the script below we cd in to Bolt first, because otherwise the gh command will fail. | ||
run: | | ||
cd Bolt | ||
Compress-Archive -Path D:\a\Bolt\Bolt\install-location\bolt-launcher -DestinationPath D:\a\Bolt\Bolt\Bolt-Windows.zip | ||
gh release upload ${{ github.event.release.tag_name }} D:\a\Bolt\Bolt\Bolt-Windows.zip |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are changed, they will be downloaded/rebuilt as needed