Skip to content

Commit

Permalink
Build script for Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pragma37 committed Jul 22, 2020
1 parent b4cf7b7 commit aa05883
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 22 deletions.
22 changes: 0 additions & 22 deletions .github/stale.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

name: BUILD-RELEASE

# Controls when the action will run. Triggers the workflow on push or pull request
on:
push:
push:
branches: [ release ]
pull_request:
branches: [ release ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]

steps:

- name : Setup Environment Variables
shell: python
run: |
import os
from os import path
main_dir = path.join(os.getcwd(),'..')
main_dir = path.abspath(main_dir)
print("::set-env name=_MAIN_DIR::{}".format(main_dir))
- name: Cache build environment
uses: actions/cache@v2
env:
cache-name: ${{ github.ref }}-${{ runner.os }}
with:
path: ${{ env._MAIN_DIR }}
key: build-cache-${{ env.cache-name }}

- uses: actions/checkout@v2

- name: Build.py
run: python build.py

- name: Upload Build
uses: actions/upload-artifact@v2
with:
name: Blender-Release-${{ runner.os }}
path: ${{ env._MAIN_DIR }}/build_release/bin/

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ Desktop.ini

# smoke simulation noise tile (generated)
waveletNoiseTile.bin

!.github
48 changes: 48 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import sys
import os
from os import path
import subprocess

print("Checkout submodules")
subprocess.check_call(['git','submodule','update','--init','--recursive'])

print("Get binary dependencies")
if sys.platform.startswith('linux'):
#Assumes apt-get
subprocess.check_call(['sudo','apt-get','update'])
subprocess.check_call(['sudo','apt-get','install','build-essential',
'git','subversion','cmake','libx11-dev','libxxf86vm-dev','libxcursor-dev',
'libxi-dev','libxrandr-dev','libxinerama-dev','libglew-dev'])

SVN_DIR= None
platform_dir = {
'win32' : 'win64_vc15',
'darwin' : 'darwin',
'linux' : 'linux_centos7_x86_64'
}
for key, value in platform_dir.items():
if sys.platform.startswith(key):
SVN_DIR = value

SVN = 'https://svn.blender.org/svnroot/bf-blender/tags/blender-2.83.1-release/lib/' + SVN_DIR
binaries_path = path.join('..','lib',SVN_DIR)
try:
subprocess.check_call(['svn','checkout',SVN,binaries_path])
except:
subprocess.check_call(['svn','switch',SVN,binaries_path])

BUILD_DIR = path.join('..','build_release')

print("Make sure the build directory exists")
if path.exists(BUILD_DIR) == False:
os.mkdir(BUILD_DIR)

print("Configure Blender project")
if sys.platform == 'win32':
#Specify 64 bits architecture on Windows
subprocess.check_call(['cmake','-A','x64','-S','.','-B',BUILD_DIR])
else:
subprocess.check_call(['cmake','-S','.','-B',BUILD_DIR])

print("Build Blender project")
subprocess.check_call(['cmake','--build',BUILD_DIR,'--target','install','--config','Release'])

0 comments on commit aa05883

Please sign in to comment.