Skip to content

Commit

Permalink
CI/CD pipeline (#76)
Browse files Browse the repository at this point in the history
* ci: initial import

* ci: ignore sonarqube for now

* ci: skip over python setup

* ci: put unity project path

* add job to build Zenject-usage.dll

* ci: give name to job

* Update main.yml

* looking for syntax error

* ci: syntax

* syntax

* ci: syntax error

* use windows-latest

* ci: checkout code

* ci: rename job to Zenject-usage

* ci: upload zenject-usage

* ci: improve step name

* copy Zenject-usage.dll to unity project

* linux uses / not \

* get from downloaded folder

* Update main.yml

* ci: fix path of test results

* semantic release configuration

* upm package description

* meta for package.json

* Add job to request license

* this can run on any branch

* No need to run CI pipeline for documentation
  • Loading branch information
paulpach authored and Mathijs-Bakker committed Jan 25, 2020
1 parent 9ecc91d commit c64ff04
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 0 deletions.
137 changes: 137 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: CI

on:
push:
paths-ignore:
- 'Documentation/**'
- '*.md'

jobs:

#enable this job to request a manual unity license
Request-License:
runs-on: ubuntu-latest
if: false
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Request manual activation file
uses: MirrorNG/unity-runner@master
with:
entrypoint: /request_activation.sh

# This will produce a Unity_xxx.alf file
# download it in your computer and upload it to
# https://license.unity3d.com/manual
# That will produce a Unity_xxx.ulf file
# add the contents of Unity_xxx.ulf file to your repository's secrets
# as UNITY_LICENSE
# then disable this job
- name: Expose as artifact
uses: actions/upload-artifact@v1
with:
name: Manual Activation File
path: ${{ steps.getManualLicenseFile.outputs.filePath }}


Zenject-usage:
runs-on: [windows-latest]
name: Zenject-usage
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup MSBuild.exe
uses: warrenbuckley/Setup-MSBuild@v1

- name: MSBuild
working-directory: AssemblyBuild\Zenject-usage
run: msbuild Zenject-usage.sln

- name: Upload dll
uses: actions/upload-artifact@v1
with:
name: Zenject-usage
path: AssemblyBuild\Zenject-usage\bin\Debug\

buildUnity:
name: Unity test
runs-on: ubuntu-latest
needs: Zenject-usage
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
steps:

# Checkout repository (required to test local actions)
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download Zenject-usage
uses: actions/download-artifact@v1
with:
name: Zenject-usage

- name: Install Zenject-usage
run: |
ls -l Zenject-usage
cp Zenject-usage/Zenject-usage.dll UnityProject/Assets/Plugins/Zenject/Source/Usage
ls -l UnityProject/Assets/Plugins/Zenject/Source/Usage
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v1
# with:
# python-version: "3.8"

# - name: Install filter-repo
# run: pip3 install git-filter-repo

- name: Activate license
uses: MirrorNG/unity-runner@master
with:
entrypoint: /activate.sh

# Configure test runner
- name: Run editor Tests
uses: MirrorNG/unity-runner@master
with:
args: -projectPath UnityProject -runTests -testPlatform editmode -testResults Tests/editmode-results.xml -enableCodeCoverage -coverageResultsPath Tests

# Upload artifacts
- name: Publish test results
uses: actions/upload-artifact@v1
with:
name: Test results (editor mode)
path: UnityProject/Tests/editmode-results.xml

# - name: Generate Solution
# uses: MirrorNG/unity-runner@master
# with:
# # Arguments to pass to unity
# args: -buildTarget StandaloneWindows64 -customBuildName MirrorNG -customBuildPath ./build/StandaloneWindows64 -projectPath . -executeMethod UnityEditor.SyncVS.SyncSolution -quit

# - name: SonarQube analysis
# uses: MirrorNG/unity-sonarscanner@master
# with:
# buildCommand: /opt/Unity/Editor/Data/NetCore/Sdk-2.2.107/dotnet build workspace.sln
# projectKey: MirrorNG_MirrorNG
# projectName: MirrorNG
# sonarOrganisation: mirrorng
# beginArguments: /d:sonar.verbose="true" /d:sonar.cs.nunit.reportsPaths=Tests/editmode-results.xml /d:sonar.cs.opencover.reportsPaths=Tests/workspace-opencov/EditMode/TestCoverageResults_0000.xml
# env:
# FrameworkPathOverride: /opt/Unity/Editor/Data/MonoBleedingEdge/
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
@semantic-release/exec
@semantic-release/changelog
@semantic-release/git
branch: master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"plugins": [
"@semantic-release/github",
"@semantic-release/release-notes-generator",
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{"type": "breaking", "release": "major"},
{"type": "feature", "release": "minor"},
]
}],
["@semantic-release/changelog", {
"changelogFile": "UnityProject/Assets/Plugins/Zenject/CHANGELOG.md",
}],
["@semantic-release/npm", {
"npmPublish": false,
"pkgRoot": "UnityProject/Assets/Plugins/Zenject"
}],
["@semantic-release/git", {
"assets": ["UnityProject/Assets/Plugins/Zenject/package.json", "UnityProject/Assets/Plugins/Zenject/CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}]
# ["@semantic-release/exec", {
# "publishCmd": "./publish_upm.sh upm ${nextRelease.version}"
# }]
]
}
8 changes: 8 additions & 0 deletions UnityProject/Assets/Plugins/Zenject/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

{
"name": "com.svermeulen.extenject",
"displayName": "Extenject",
"version": "0.0.1",
"description": "Dependency Injection Framework for Unity3D",
"dependencies": {}
}
8 changes: 8 additions & 0 deletions UnityProject/Assets/Plugins/Zenject/package.json.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c64ff04

Please sign in to comment.