Refactor CI to use Matrix Strategy #14
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 | |
- release/* | |
pull_request: | |
branches: | |
- main | |
- release/* | |
jobs: | |
ci: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu | |
download: curl -o ./Unity.tar.xz -k https://download.unity3d.com/download_unity/887be4894c44/LinuxEditorInstaller/Unity.tar.xz | |
install: mkdir -p ~/Unity && tar -xf Unity.tar.xz -C ~/Unity | |
- os: macos | |
download: curl -o ./unity.pkg -k https://download.unity3d.com/download_unity/887be4894c44/MacEditorInstaller/Unity.pkg | |
install: sudo installer -package unity.pkg -target / | |
- os: windows | |
download: bitsadmin /TRANSFER unity /DOWNLOAD /PRIORITY foreground "https://download.unity3d.com/download_unity/887be4894c44/Windows64EditorInstaller/UnitySetup64-2022.3.22f1.exe" "%CD%\unitysetup.exe" | |
install: unitysetup.exe /UI=reduced /S /D=%ProgramFiles%\Unity | |
runs-on: ${{ matrix.os }}-latest | |
permissions: | |
actions: read | |
contents: read | |
deployments: read | |
packages: none | |
pull-requests: write | |
security-events: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Download Unity | |
run: ${{ matrix.download }} | |
- name: Install Unity | |
run: ${{ matrix.install }} | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
- name: Build | |
run: dotnet build -c Debug ./src/Microsoft.Unity.Analyzers.sln /p:UseSharedCompilation=false | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: 1 | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
- name: Test context (main) | |
if: github.ref == 'refs/heads/main' | |
run: echo "TEST_FILTER=." >> $GITHUB_ENV | |
- name: Test context (feature) | |
if: github.ref != 'refs/heads/main' | |
run: echo "TEST_FILTER=FullyQualifiedName!~ConsistencyTests" >> $GITHUB_ENV | |
- name: Test | |
run: dotnet test -c Debug ./src/Microsoft.Unity.Analyzers.Tests --filter ${{env.TEST_FILTER}} | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: 1 |