Skip to content

Commit

Permalink
CI: Setup PR workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mklabs committed Nov 27, 2022
1 parent ced53a0 commit 7e6aa0a
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: (Windows) Build Plugin

on:
workflow_call:
secrets:
DOCKER_TOKEN:
required: true
DOCKER_USERNAME:
required: true

jobs:
linux-build-plugin:
runs-on: ubuntu-latest

strategy:
matrix:
unreal: ['4.27', '5.0.2', '5.1']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Free disk space
if: ${{ steps.exists.outputs.value == 0 }}
run: |
# time df -h
sudo time swapoff -a
sudo time rm -f /swapfile
sudo time rm -rf /usr/local/lib/android
sudo time rm -rf /usr/share/dotnet
sudo time rm -rf /usr/share/swift
sudo time rm -rf /usr/local/.ghcup
sudo time rm -rf /usr/local/lib/node_modules
sudo time rm -rf /usr/lib/google-cloud-sdk
sudo time rm -rf /opt/pipx
sudo time rm -rf "$AGENT_TOOLSDIRECTORY"
sudo time apt-get clean
sudo time rm -rf /var/lib/apt/lists/*
# time docker rmi $(docker image ls -aq)
# time du --max-depth=3 --threshold=100M -h /usr /opt /var 2>/dev/null | sort -hr
df -h
- name: Run Docker container
run: |
echo ${{ secrets.DOCKER_TOKEN }} | docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker run -td --name unreal --user root \
-v ${{ github.workspace }}:/ue4-targetsystemplugin \
--workdir /ue4-targetsystemplugin/TargetSystem \
ghcr.io/epicgames/unreal-engine:dev-slim-${{ matrix.unreal }}
- name: Installing Linux Dependencies
run: |
docker exec unreal sudo apt-get update
docker exec unreal pip3 install --upgrade pip
- name: Installing UE CLI
run:
docker exec unreal pip3 install ue4cli

- name: Configuring UE CLI
run:
docker exec unreal ue4 setroot /home/ue4/UnrealEngine

- name: Package plugin
run: docker exec unreal ue4 package
46 changes: 46 additions & 0 deletions .github/workflows/pr-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: (Windows) Build Plugin

on:
workflow_call:
secrets:
WIN_UNREAL_ENGINE_ROOT:
required: true

jobs:
windows-build-plugin:
name: Build & Test

if: github.actor == 'mklabs'
runs-on: [self-hosted, Windows]

strategy:
matrix:
unreal: ['4.27', '5.0.2', '5.1']

steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Store prev ue4 cli root
id: vars-ue4
run: >-
echo "::set-output name=prev_ue4_cli_root::$(ue4 root)"
- name: Configuring UE CLI
run:
ue4 setroot "${{ secrets.WIN_UNREAL_ENGINE_ROOT }}UE_${{ matrix.unreal }}"

- name: Package plugin
run: ue4 package
working-directory: TargetSystem

# TODO: Sanity checks automated testing (missing unit / functional tests to run as of now)

- name: Restore UE CLI Configuration
if: always()
run:
ue4 setroot "${{ steps.vars-ue4.outputs.prev_ue4_cli_root }}"
23 changes: 23 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: PR - Build Plugin & Run Tests

on:
pull_request:
branches: [ master, dev, dev-ue5 ]

concurrency:
group: pr-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build-on-pr-windows:
name: (Windows) Build
uses: ./.github/workflows/pr-tests-windows.yml
secrets:
WIN_UNREAL_ENGINE_ROOT: ${{ secrets.WIN_UNREAL_ENGINE_ROOT }}

build-linux:
name: (Linux) Build
uses: ./.github/workflows/build-linux.yml
secrets:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

0 comments on commit 7e6aa0a

Please sign in to comment.