Skip to content

Merge pull request #1632 from WEKIT-ECS/ghostFingers #1428

Merge pull request #1632 from WEKIT-ECS/ghostFingers

Merge pull request #1632 from WEKIT-ECS/ghostFingers #1428

name: Linux workflow
on: [push, pull_request]
jobs:
test:
name: Test Unity
runs-on: ubuntu-latest
steps:
# Activation stage
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: 'true'
- name: LFS pull
run: git lfs pull
- name: Set up IBM Watson credentials
env:
ASSISTANTKEYS: ${{ secrets.ASSISTANTKEYS }}
run: |
echo -n "$ASSISTANTKEYS" > $GITHUB_WORKSPACE/ibm-credentials.env
echo "path of the credentials resource $GITHUB_WORKSPACE/ibm-credentials.txt"
export IBM_CREDENTIALS_FILE="$GITHUB_WORKSPACE/ibm-credentials.env"
# Fonts
- name: Install fonts
run: |
echo -n "Installing core fonts"
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | sudo debconf-set-selections
echo "ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note" | sudo debconf-set-selections
sudo apt install ttf-mscorefonts-installer
sudo fc-cache -f
fc-match Arial
# Cache
- name: Caching
uses: actions/cache@v3
with:
path: Library
key: Library-linux-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-linux
# Test stage
- name: Unity Test runner (edit and play mode)
uses: game-ci/[email protected]
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
unityVersion: 2021.3.8f1
build:
name: Build Unity
runs-on: ubuntu-latest
needs: test
outputs:
buildVersion: ${{ steps.buildStep.outputs.buildVersion }}
steps:
# Activation stage
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: 'true'
- name: LFS pull
run: git lfs pull
- name: Set up IBM Watson credentials
env:
ASSISTANTKEYS: ${{ secrets.ASSISTANTKEYS }}
run: |
echo -n "$ASSISTANTKEYS" > $GITHUB_WORKSPACE/ibm-credentials.env
ls -la
echo "path of the credentials resource $GITHUB_WORKSPACE/ibm-credentials.txt"
export IBM_CREDENTIALS_FILE="$GITHUB_WORKSPACE/ibm-credentials.env"
export TARGET_PLATFORM="Android"
# Fonts
- name: Install fonts
run: |
echo -n "Installing core fonts"
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | sudo debconf-set-selections
echo "ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note" | sudo debconf-set-selections
sudo apt install ttf-mscorefonts-installer
sudo fc-cache -f
fc-match Arial
# Cache
- name: Caching
uses: actions/cache@v3
with:
path: Library
key: Library-linux-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-linux
# Build stage
- name: Unity builder
uses: game-ci/[email protected]
id: buildStep
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
targetPlatform: Android
unityVersion: 2021.3.8f1
versioning: Semantic
# dirty build needed to include generated Watson credentials
allowDirtyBuild: true
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: Android
path: build
retention-days: 3
if-no-files-found: error
# Deploy stage
prerelease-notification:
name: Prerelease Slack notification
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/develop' && !github.event.pull_request
env:
SLACK_URL: ${{ secrets.SLACK_URL }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
APP_VERSION: ${{ needs.build.outputs.buildVersion }}
TARGET_PLATFORM: $RUNNER_OS
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Post notification
run: |
echo $APP_VERSION
sudo apt-get update && sudo apt-get -y install curl
chmod +x ./ci/notify-preview.sh && ./ci/notify-preview.sh