Refactor CI to use Matrix Strategy #19
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/* | ||
env: | ||
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
DOTNET_NOLOGO: 1 | ||
jobs: | ||
ci: | ||
strategy: | ||
matrix: # unfortunately accessing env variables in a matrix definition is not supported. I would love to extract hash/version | ||
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: cmd /c bitsadmin /TRANSFER unity /DOWNLOAD /PRIORITY foreground "https://download.unity3d.com/download_unity/887be4894c44/Windows64EditorInstaller/UnitySetup64-2022.3.22f1.exe" "%CD%\unitysetup.exe" | ||
install: cmd /c unitysetup.exe /UI=reduced /S /D=%ProgramFiles%\Unity | ||
name: CI-${{ runner.os }} | ||
Check failure on line 32 in .github/workflows/ci-matrix.yml GitHub Actions / CIInvalid workflow file
|
||
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 on ${{ matrix.os }} | ||
run: ${{ matrix.download }} | ||
- name: Install Unity on ${{ matrix.os }} | ||
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 | ||
- 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 | ||
shell: pwsh |