Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 204db47

Browse files
authored
Enable CI for Linux CG. (#703)
1 parent d9652bd commit 204db47

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 */60 * *'
8+
9+
10+
jobs:
11+
build:
12+
runs-on: self-hosted
13+
steps:
14+
- id: build-and-test
15+
name: Build SDK and run tests
16+
run: |
17+
docker run -id native-sdk-ubuntu:108 >> container_id.out
18+
container_id="$(cat container_id.out)"
19+
docker exec $container_id git config --global user.name "github-actions"
20+
docker exec $container_id git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
21+
docker exec -w /workspace/owt-linux/src $container_id git fetch origin $GITHUB_REF
22+
docker exec -w /workspace/owt-linux/src $container_id git checkout FETCH_HEAD
23+
docker exec -w /workspace/owt-linux/src $container_id git rev-parse HEAD >> git_sha.out
24+
git_sha="$(cat git_sha.out)"
25+
echo "::set-output name=git_sha::$git_sha"
26+
docker exec $container_id python3 scripts/ci/ci.py
27+
docker stop $container_id
28+
docker rm $container_id
29+
- id: cleanup
30+
name: Clean up
31+
if: ${{ always() }}
32+
run: |
33+
# They should be stopped earlier in the first step, but if there are containers running, kill them.
34+
if [ docker ps -q --filter ancestor=native-sdk-ubuntu ]; then
35+
docker kill $(docker ps -q --filter ancestor=native-sdk-ubuntu)
36+
docker rm $(docker ps -q --filter ancestor=native-sdk-ubuntu)
37+
fi
38+
rm container_id.out
39+
rm git_sha.out

scripts/ci/ci.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright (C) <2020> Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
'''Script for build in continuous integration environment.
6+
7+
It synchronizes code, and builds SDK. Please run this script with python 3.4 or
8+
newer on Ubuntu 22.04, other platforms are not supported yet.
9+
10+
It's expected to be ran on continuous integration machines and nightly build
11+
machines.
12+
'''
13+
14+
import subprocess
15+
import sys
16+
from pathlib import Path
17+
18+
SRC_PATH = Path(__file__).resolve().parents[2]
19+
GIT_BIN = 'git.bat' if sys.platform == 'win32' else 'git'
20+
GCLIENT_BIN = 'gclient.bat' if sys.platform == 'win32' else 'gclient'
21+
22+
def sync():
23+
if subprocess.call([GCLIENT_BIN, 'sync', '--reset', '--nohooks'], cwd=SRC_PATH, shell=False):
24+
return False
25+
return True
26+
27+
def run_hooks():
28+
if subprocess.call([GCLIENT_BIN, 'runhooks'], cwd=SRC_PATH, shell=False):
29+
return False
30+
return True
31+
32+
33+
def build():
34+
if subprocess.call(['python3', SRC_PATH/'scripts'/'build_linux.py', '--gn_gen', '--sdk', '--output_path', 'dist', '--scheme', 'release', '--shared', '--use_gcc', '--arch', 'x64', '--cloud_gaming']):
35+
return False
36+
return True
37+
38+
39+
def main():
40+
if not sync():
41+
return 1
42+
if not run_hooks():
43+
return 1
44+
if not build():
45+
return 1
46+
return 0
47+
48+
49+
if __name__ == '__main__':
50+
sys.exit(main())

0 commit comments

Comments
 (0)