chore(workflows): add ci and release workflows #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Git LFS | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v3 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
# Cache | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: Run Unity Tests | |
uses: game-ci/unity-test-runner@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
projectPath: . | |
testMode: all | |
artifactsPath: TestResults | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: Test Results | |
path: TestResults | |
format: | |
name: Check Code Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Install dotnet-format | |
run: dotnet tool install -g dotnet-format | |
- name: Check C# Formatting | |
run: | | |
echo "Current working directory: $(pwd)" | |
echo "Directory contents:" | |
ls -la | |
EXIT_CODE=0 | |
while IFS= read -r project; do | |
echo "Checking format for: $project" | |
if ! dotnet format --verify-no-changes "$project"; then | |
echo "❌ Formatting issues found in $project" | |
EXIT_CODE=1 | |
fi | |
done < <(find . -name "*.csproj") | |
exit $EXIT_CODE |