diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ae4c3c5 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,76 @@ +name: Tests + +# Builds everything, native and managed, and runs the tests. One workflow for every repository, as marks.yml: the core +# runs it as it is; a module calls it and is checked out into modules/ of a checkout of the core. +# +# Windows with the Visual Studio the native toolset asks for (Shared/Build/Stellar.Native.props), C++/CLI included. + +on: + push: + branches: [develop, master] + pull_request: + workflow_call: + +permissions: + contents: read + +concurrency: + group: tests-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + tests: + name: Tests + if: vars.STELLAR_MIRROR != 'true' + runs-on: windows-2025-vs2026 + timeout-minutes: 45 + env: + IS_CORE: ${{ github.event.repository.name == 'StellarEngine-Core' }} + DOTNET_NOLOGO: 'true' + DOTNET_CLI_TELEMETRY_OPTOUT: 'true' + steps: + - name: Checkout + if: env.IS_CORE == 'true' + uses: actions/checkout@v5 + + - name: Checkout the core + if: env.IS_CORE != 'true' + uses: actions/checkout@v5 + with: + repository: QuantumDevTeam/StellarEngine-Core + ref: develop + + - name: Checkout the module + if: env.IS_CORE != 'true' + uses: actions/checkout@v5 + with: + path: modules/${{ github.event.repository.name }} + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + global-json-file: global.json + + - name: Build and test the core + if: env.IS_CORE == 'true' + shell: pwsh + run: | + New-Item -ItemType Directory -Force packages | Out-Null + ./scripts/build.ps1 -Configuration Debug + + # Its own tests ran in the repository of the core + - name: Install the core + if: env.IS_CORE != 'true' + shell: pwsh + run: | + New-Item -ItemType Directory -Force packages | Out-Null + ./scripts/build.ps1 -Configuration Debug -SkipTests -Install -NoUserRegistration + + - name: Build and test the module + if: env.IS_CORE != 'true' + shell: pwsh + env: + MODULE: ${{ github.event.repository.name }} + run: | + dotnet run --project SDK/src/Stellar.Cli/Stellar.Cli.csproj -c Debug --no-build -- modules build $env:MODULE --tests --pack + exit $LASTEXITCODE diff --git a/Shared/Templates/Modules/Managed/.github/workflows/tests.yml b/Shared/Templates/Modules/Managed/.github/workflows/tests.yml new file mode 100644 index 0000000..c9fa495 --- /dev/null +++ b/Shared/Templates/Modules/Managed/.github/workflows/tests.yml @@ -0,0 +1,15 @@ +name: Tests + +# The module built and tested on the core, by the workflow of the core. + +on: + push: + branches: [develop, master] + pull_request: + +permissions: + contents: read + +jobs: + tests: + uses: QuantumDevTeam/StellarEngine-Core/.github/workflows/tests.yml@develop