-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
177 additions
and
0 deletions.
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,114 @@ | ||
name: Build | ||
on: | ||
# Build on commits pushed, except when explicitly skipped. | ||
push: | ||
branches-ignore: | ||
- 'no-ci-**' | ||
- 'skip-ci-**' | ||
# Build on pull requests, except drafts. | ||
pull_request: | ||
# Build on a schedule to keep up with the engine changes. | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
|
||
env: | ||
# Common settings. | ||
CMAKE_VERSION: 3.21.x | ||
# Common paths. | ||
ci_source_dir: ${{ github.workspace }}/source-code | ||
ci_build_script: ./source-code/ci_build.sh | ||
ci_build_dir: ${{ github.workspace }}/cmake-build | ||
ci_native_sdk_dir: ${{ github.workspace }}/SDK-native | ||
ci_target_sdk_dir: ${{ github.workspace }}/SDK-target | ||
# Parameters for uploading binaries to GitHub | ||
ci_latest_release_url: https://uploads.github.com/repos/rbfx/Core.SamplePlugin/releases/173685124/assets{?name,label} | ||
ci_latest_release_id: 173685124 | ||
|
||
jobs: | ||
CheckSkipCI: | ||
runs-on: ubuntu-20.04 | ||
if: | | ||
!contains(github.event.head_commit.message, '[skip ci]') && | ||
!contains(github.event.pull_request.title, '[skip ci]') && | ||
!contains(github.event.head_commit.message, '[skip-ci]') && | ||
!contains(github.event.pull_request.title, '[skip-ci]') | ||
steps: | ||
- run: exit 0 | ||
|
||
Windows: | ||
if: github.event.pull_request.draft == false | ||
runs-on: windows-2022 | ||
needs: [CheckSkipCI] | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
env: | ||
ci_platform: windows | ||
ci_target_sdk_name: rebelfork-sdk-Windows-msvc-rel-dll-x64-latest.zip | ||
ci_upload_release: ${{ | ||
(github.repository == 'rbfx/Core.SamplePlugin') && | ||
(github.ref == 'refs/heads/ek/ci') | ||
}} | ||
|
||
steps: | ||
- name: Checkout Plugin | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ${{ env.ci_source_dir }} | ||
fetch-depth: 1 | ||
submodules: true | ||
|
||
- name: Download target SDK | ||
uses: robinraju/[email protected] | ||
with: | ||
repository: rbfx/rbfx | ||
tag: latest | ||
fileName: ${{ env.ci_target_sdk_name }} | ||
|
||
- name: Unzip target SDK | ||
run: | | ||
cd ${{ github.workspace }} | ||
unzip ${{ env.ci_target_sdk_name }} | ||
mv ./SDK ./SDK-target | ||
- name: Setup cmake | ||
uses: jwlawson/actions-setup-cmake@v1 | ||
with: | ||
cmake-version: '${{ env.CMAKE_VERSION }}' | ||
|
||
- name: Dependencies | ||
shell: bash | ||
run: ${{ env.ci_build_script }} dependencies | ||
|
||
- name: Generate | ||
shell: bash | ||
run: ${{ env.ci_build_script }} generate | ||
|
||
- name: Build | ||
shell: bash | ||
run: ${{ env.ci_build_script }} build | ||
|
||
- name: Prepare binaries | ||
if: ${{ env.ci_upload_release == 'true' }} | ||
shell: bash | ||
run: ${{ env.ci_build_script }} prepare | ||
|
||
- name: Zip binaries | ||
if: ${{ env.ci_upload_release == 'true' }} | ||
uses: TheDoctor0/[email protected] | ||
with: | ||
directory: ${{ env.ci_build_dir }}/upload/ | ||
filename: ${{ github.workspace }}/upload.zip | ||
path: '.' | ||
|
||
- name: Release binaries | ||
if: ${{ env.ci_upload_release == 'true' }} | ||
uses: WebFreak001/[email protected] | ||
with: | ||
upload_url: ${{ env.ci_latest_release_url }} | ||
release_id: ${{ env.ci_latest_release_id }} | ||
asset_path: ${{ github.workspace }}/upload.zip | ||
asset_name: 'Core.SamplePlugin-${{ github.job }}-latest.zip' | ||
asset_content_type: application/zip | ||
max_releases: 1 |
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,63 @@ | ||
#!/usr/bin/env bash | ||
|
||
# build.sh <action> ... | ||
# ci_platform: windows | ||
# ci_action: dependencies|generate|build|install|test | ||
# ci_source_dir: source code directory | ||
# ci_build_dir: cmake cache directory | ||
# ci_native_sdk_dir: native SDK (linux) installation directory | ||
# ci_target_sdk_dir: target SDK (web) installation directory | ||
|
||
ci_action=$1; shift; | ||
ci_source_dir=${ci_source_dir%/}; # remove trailing slash if any | ||
|
||
echo "ci_platform=$ci_platform" | ||
echo "ci_action=$ci_action" | ||
echo "ci_source_dir=$ci_source_dir" | ||
echo "ci_build_dir=$ci_build_dir" | ||
echo "ci_native_sdk_dir=$ci_native_sdk_dir" | ||
echo "ci_target_sdk_dir=$ci_target_sdk_dir" | ||
|
||
declare -A build_config=( | ||
[web]='Release' | ||
[windows]='RelWithDebInfo' | ||
) | ||
|
||
function action-dependencies() { | ||
: | ||
} | ||
|
||
function action-generate() { | ||
local params=( | ||
"-B" | ||
"$ci_build_dir" | ||
"-S" | ||
"$ci_source_dir" | ||
"-DREBELFORK_SDK=$ci_target_sdk_dir" | ||
) | ||
|
||
if [[ "$ci_platform" == "windows" ]]; then | ||
params+=( | ||
"-G" | ||
"Visual Studio 17 2022" | ||
"-A" | ||
"x64" | ||
"-DCMAKE_BUILD_TYPE=${build_config[$ci_platform]}" | ||
) | ||
fi | ||
|
||
cmake "${params[@]}" | ||
} | ||
|
||
function action-build() { | ||
cmake --build $ci_build_dir --parallel $(nproc) --config ${build_config[$ci_platform]} | ||
} | ||
|
||
function action-prepare() { | ||
cd $ci_build_dir | ||
ls | ||
mkdir upload | ||
cp *.dll *.lib *.exp *.pdb ./upload/ | ||
} | ||
|
||
action-$ci_action |