Refactor CI to use Matrix Strategy (#322)
This commit is contained in:
Родитель
1bf605d6dd
Коммит
7eb00d0f48
|
@ -1,13 +0,0 @@
|
|||
name: 'Set environment variables'
|
||||
description: 'Configures environment variables for a workflow'
|
||||
inputs:
|
||||
varFilePath:
|
||||
description: 'File path to variable file or directory. Defaults to ./.github/variables/* if none specified and runs against each file in that directory.'
|
||||
required: false
|
||||
default: ./.github/variables/*
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: |
|
||||
sed "" ${{ inputs.varFilePath }} >> $GITHUB_ENV
|
||||
shell: bash
|
|
@ -1,2 +0,0 @@
|
|||
UNITY_HASH=887be4894c44
|
||||
UNITY_FULL_VERSION=2022.3.22f1
|
|
@ -1,71 +0,0 @@
|
|||
name: CI-Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
deployments: read
|
||||
packages: none
|
||||
pull-requests: write
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Set Environment Variables
|
||||
uses: ./.github/actions/setvars
|
||||
with:
|
||||
varFilePath: ./.github/variables/unity.env
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
include-prerelease: false
|
||||
|
||||
- name: Download Unity
|
||||
run: curl -o ./Unity.tar.xz -k https://download.unity3d.com/download_unity/${{ env.UNITY_HASH }}/LinuxEditorInstaller/Unity.tar.xz
|
||||
|
||||
- name: Install Unity
|
||||
run: mkdir -p ~/Unity && tar -xf Unity.tar.xz -C ~/Unity
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
|
||||
- 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@v2
|
||||
|
||||
- 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
|
|
@ -1,71 +0,0 @@
|
|||
name: CI-macOS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
|
||||
jobs:
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
deployments: read
|
||||
packages: none
|
||||
pull-requests: write
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Set Environment Variables
|
||||
uses: ./.github/actions/setvars
|
||||
with:
|
||||
varFilePath: ./.github/variables/unity.env
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
include-prerelease: false
|
||||
|
||||
- name: Download Unity
|
||||
run: curl -o ./unity.pkg -k https://download.unity3d.com/download_unity/${{ env.UNITY_HASH }}/MacEditorInstaller/Unity.pkg
|
||||
|
||||
- name: Install Unity
|
||||
run: sudo installer -package unity.pkg -target /
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
|
||||
- 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@v2
|
||||
|
||||
- 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
|
|
@ -0,0 +1,99 @@
|
|||
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
|
||||
UNITY_HASH: '887be4894c44'
|
||||
UNITY_FULL_VERSION: '2022.3.22f1'
|
||||
|
||||
jobs:
|
||||
compute:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
deployments: read
|
||||
packages: none
|
||||
pull-requests: write
|
||||
security-events: write
|
||||
outputs:
|
||||
UNITY_HASH: ${{ env.UNITY_HASH }}
|
||||
UNITY_FULL_VERSION: ${{ env.UNITY_FULL_VERSION }}
|
||||
steps:
|
||||
- name: Compute outputs
|
||||
run: |
|
||||
echo "UNITY_HASH=${{ env.UNITY_HASH }}" >> $GITHUB_OUTPUT
|
||||
echo "UNITY_FULL_VERSION=${{ env.UNITY_FULL_VERSION }}" >> $GITHUB_OUTPUT
|
||||
|
||||
ci:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu
|
||||
download: curl -o ./Unity.tar.xz -k https://download.unity3d.com/download_unity/${{ needs.compute.outputs.UNITY_HASH }}/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/${{ needs.compute.outputs.UNITY_HASH }}/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/${{ needs.compute.outputs.UNITY_HASH }}/Windows64EditorInstaller/UnitySetup64-${{ needs.compute.outputs.UNITY_FULL_VERSION }}.exe" "%CD%\unitysetup.exe"
|
||||
install: cmd /c unitysetup.exe /UI=reduced /S /D=%ProgramFiles%\Unity
|
||||
name: CI-${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
needs: compute
|
||||
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
|
||||
shell: bash
|
||||
|
||||
- name: Test context (feature)
|
||||
if: github.ref != 'refs/heads/main'
|
||||
run: echo "TEST_FILTER=FullyQualifiedName!~ConsistencyTests" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Test
|
||||
run: dotnet test -c Debug ./src/Microsoft.Unity.Analyzers.Tests --filter ${{env.TEST_FILTER}}
|
||||
shell: bash
|
|
@ -1,77 +0,0 @@
|
|||
name: CI-Windows
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
deployments: read
|
||||
packages: none
|
||||
pull-requests: write
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Set Environment Variables
|
||||
uses: ./.github/actions/setvars
|
||||
with:
|
||||
varFilePath: ./.github/variables/unity.env
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
include-prerelease: false
|
||||
|
||||
- name: Download Unity
|
||||
run: bitsadmin /TRANSFER unity /DOWNLOAD /PRIORITY foreground "https://download.unity3d.com/download_unity/${{ env.UNITY_HASH }}/Windows64EditorInstaller/UnitySetup64-${{ env.UNITY_FULL_VERSION }}.exe" "%CD%\unitysetup.exe"
|
||||
shell: cmd
|
||||
|
||||
- name: Install Unity
|
||||
run: unitysetup.exe /UI=reduced /S /D=%ProgramFiles%\Unity
|
||||
shell: cmd
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
|
||||
- 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
|
||||
shell: cmd
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
|
||||
- name: Test context (main)
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: echo "TEST_FILTER=." >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Test context (feature)
|
||||
if: github.ref != 'refs/heads/main'
|
||||
run: echo "TEST_FILTER=FullyQualifiedName!~ConsistencyTests" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- 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
|
||||
shell: cmd
|
|
@ -1,8 +1,6 @@
|
|||
# Analyzers for Unity
|
||||
|
||||
[![Build status on Windows](https://github.com/microsoft/Microsoft.Unity.Analyzers/workflows/CI-Windows/badge.svg)](https://github.com/microsoft/Microsoft.Unity.Analyzers/actions?query=workflow%3ACI-Windows)
|
||||
[![Build status on macOS](https://github.com/microsoft/Microsoft.Unity.Analyzers/workflows/CI-macOS/badge.svg)](https://github.com/microsoft/Microsoft.Unity.Analyzers/actions?query=workflow%3ACI-macOS)
|
||||
[![Build status on Linux](https://github.com/microsoft/Microsoft.Unity.Analyzers/workflows/CI-Linux/badge.svg)](https://github.com/microsoft/Microsoft.Unity.Analyzers/actions?query=workflow%3ACI-Linux)
|
||||
[![Build status](https://github.com/microsoft/Microsoft.Unity.Analyzers/workflows/CI/badge.svg)](https://github.com/microsoft/Microsoft.Unity.Analyzers/actions?query=workflow%3ACI)
|
||||
[![NuGet](https://img.shields.io/nuget/v/Microsoft.Unity.Analyzers.svg)](https://nuget.org/packages/Microsoft.Unity.Analyzers)
|
||||
|
||||
This project provides Visual Studio with a better understanding of Unity projects by adding Unity-specific diagnostics or by removing general C# diagnostics that do not apply to Unity projects.
|
||||
|
|
Загрузка…
Ссылка в новой задаче