Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Continuous Integration

on:
push:
branches: [develop]
pull_request:

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ${{ matrix.os.fullname }}
timeout-minutes: 60
env:
OSU_EXECUTION_MODE: ${{ matrix.threadingMode }}
strategy:
fail-fast: false
matrix:
os:
- { prettyname: Windows, fullname: windows-latest, configuration: Debug }
- { prettyname: macOS, fullname: macos-latest, configuration: Debug } # ARM: veja o item 3 abaixo
- { prettyname: Linux, fullname: ubuntu-latest, configuration: Debug }
- { prettyname: Linux, fullname: ubuntu-latest, configuration: Release }
threadingMode: ["SingleThread", "MultiThreaded"]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install .NET 10.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Compile
run: dotnet build -c ${{ matrix.os.configuration }} osu-framework-msdf.slnx

- name: Test
run: >
dotnet test osu-framework-msdf.slnx
-c ${{ matrix.os.configuration }}
--no-build
--results-directory ${{ github.workspace }}/TestResults
--logger "trx;LogFileName=TestResults-${{ matrix.os.prettyname }}-${{ matrix.threadingMode }}-${{ matrix.os.configuration }}.trx"
-- NUnit.ConsoleOut=0

# Sobe os resultados mesmo se o teste falhar.
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: libmsdf-test-results-${{ matrix.os.prettyname }}-${{ matrix.threadingMode }}-${{ matrix.os.configuration }}
path: ${{ github.workspace }}/TestResults/TestResults-${{ matrix.os.prettyname }}-${{ matrix.threadingMode }}-${{ matrix.os.configuration }}.trx
if-no-files-found: error
144 changes: 144 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Package and NuGet

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"

permissions:
contents: read

jobs:
notify_process_deploy:
name: Notify start
runs-on: ubuntu-latest
continue-on-error: true
env:
WEBHOOK_URL: ${{ secrets.DISCORD_INFRA_WEBHOOK_URL }}
steps:
- name: Notify Deployment
run: |
export TITLE="🚀 Deployment in Progress: libmsdf ($GITHUB_REF_NAME)"
export URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
export DESCRIPTION="A new deployment for **libmsdf** has started."$'\n'"Stay tuned for updates!"$'\n'"➜ [View Workflow Run]($URL)"
export ACTOR_ICON="https://avatars.githubusercontent.com/u/$GITHUB_ACTOR_ID"

BODY="$(jq --null-input '{
embeds: [{
title: env.TITLE,
color: 15098112,
description: env.DESCRIPTION,
url: env.URL,
author: { name: env.GITHUB_ACTOR, icon_url: env.ACTOR_ICON }
}]
}')"

curl --fail -H "Content-Type: application/json" -d "$BODY" "$WEBHOOK_URL"

test:
name: Test (${{ matrix.threadingMode }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: true
matrix:
threadingMode: ["SingleThread", "MultiThreaded"] # TODO: corte se não usar GameHost, igual ao ci.yml
env:
OSU_EXECUTION_MODE: ${{ matrix.threadingMode }}
steps:
- name: Checkout
uses: actions/checkout@v4 # TODO: fixar por SHA
with:
persist-credentials: false

- name: Install .NET
uses: actions/setup-dotnet@v4 # TODO: fixar por SHA
with:
dotnet-version: "10.0.x"

- name: Test
run: dotnet test SuaSolucao.sln -c Release # TODO: nome real da .sln

pack:
name: Pack (libmsdf)
needs: [test]
runs-on: ubuntu-latest
environment: production
timeout-minutes: 15
permissions:
contents: read
id-token: write
env:
ARTIFACTS: ${{ github.workspace }}/artifacts
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4 # TODO: fixar por SHA
with:
persist-credentials: false

- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Pack (libmsdf)
run: dotnet pack lib -c Release /p:Version="${VERSION#v}" -o "$ARTIFACTS"

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: libmsdf
path: ${{ github.workspace }}/artifacts/*.nupkg
if-no-files-found: error

- name: NuGet login (OIDC)
id: login
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841
with:
user: ${{ vars.NUGET_USER }}

- name: Publish packages to NuGet
env:
NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
run: >
dotnet nuget push "$ARTIFACTS"/*.nupkg
--api-key "$NUGET_API_KEY"
--source https://api.nuget.org/v3/index.json
--skip-duplicate

notify_status_deploy:
name: Notify result
needs: [test, pack]
if: always()
runs-on: ubuntu-latest
continue-on-error: true
env:
PACK_RESULT: ${{ needs.pack.result }}
WEBHOOK_URL: ${{ secrets.DISCORD_INFRA_WEBHOOK_URL }}
steps:
- name: Notify Deployment Status
run: |
export TITLE="🚀 Deployment Completed: libmsdf ($GITHUB_REF_NAME)"
export URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"

if [ "$PACK_RESULT" = "success" ]; then
STATUS="✅ Deployment successful!"; export COLOR=3066993
else
STATUS="❌ Deployment failed. Check logs for details."; export COLOR=15158332
fi

export DESCRIPTION="Deployment for **libmsdf** has finished."$'\n'"$STATUS"$'\n'"➜ [View Workflow Run]($URL)"
export ACTOR_ICON="https://avatars.githubusercontent.com/u/$GITHUB_ACTOR_ID"

BODY="$(jq --null-input '{
embeds: [{
title: env.TITLE,
color: (env.COLOR | tonumber),
description: env.DESCRIPTION,
url: env.URL,
author: { name: env.GITHUB_ACTOR, icon_url: env.ACTOR_ICON }
}]
}')"

curl --fail -H "Content-Type: application/json" -d "$BODY" "$WEBHOOK_URL"
42 changes: 42 additions & 0 deletions .github/workflows/report-nunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Annotate CI run with Test Results

on:
workflow_run:
workflows: ["Continuous Integration"]
types: [completed]

permissions:
contents: read
actions: read
checks: write

jobs:
annotate:
name: Annotate CI run with Test Results
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'cancelled' }}
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.event.workflow_run.repository.full_name }}
ref: ${{ github.event.workflow_run.head_sha }}
persist-credentials: false

- name: Download results
uses: actions/download-artifact@v4
with:
pattern: libmsdf-test-results-*
merge-multiple: true
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Annotate CI run with Test Results
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2
with:
name: Results
path: "*.trx"
reporter: dotnet-trx
list-suites: "failed"
list-tests: "failed"
Loading