pruebas automatica intento 90002 -> clang en vez de msvc #31
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: Pruebas | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- '**.hpp' | |
- '**.cpp' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- '**.hpp' | |
- '**.cpp' | |
jobs: | |
construir-y-probar: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Instalar Clang 19.1.4 | |
run: | | |
mkdir clang-19.1.4 | |
cd clang-19.1.4 | |
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.4/clang+llvm-19.1.4-x86_64-windows-msvc.zip | |
powershell -Command "Expand-Archive -Path clang+llvm-19.1.4-x86_64-windows-msvc.zip -DestinationPath ." | |
echo "LLVM and Clang installed to $(pwd)" | |
- name: Configurar CMake con Clang 19.1.4 y C++20 | |
run: | | |
set CXX=%CD%\clang-19.1.4\clang+llvm-19.1.4-x86_64-windows-msvc\bin\clang++ | |
set CC=%CD%\clang-19.1.4\clang+llvm-19.1.4-x86_64-windows-msvc\bin\clang | |
echo "CXX and CC are set to Clang 19.1.4" | |
set CLANG_BIN=%CD%\clang-19.1.4\clang+llvm-19.1.4-x86_64-windows-msvc\bin | |
set PATH=%CLANG_BIN%;%PATH% | |
echo "Clang binaries are added to the PATH" | |
cmake -S . -B build -DCMAKE_C_COMPILER=%CLANG_BIN%\clang -DCMAKE_CXX_COMPILER=%CLANG_BIN%\clang++ -DCMAKE_CXX_STANDARD=20 -G "Ninja" | |
- name: Compilar | |
run: | | |
cmake --build build | |
- name: Ejecutar Pruebas | |
id: ejecutar_pruebas | |
run: | | |
build\correr_pruebas.exe -s | |
- name: Publicar Resultados de Pruebas (en caso de fallos) | |
if: failure() | |
run: | | |
echo "Resultados de las pruebas:" | |
type build\Testing\Temporary\LastTest.log | |
- name: Actualizar Descripción de PR o Commit | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
// Determinar el resultado de las pruebas | |
const testOutcome = context.payload.workflow_run.conclusion === 'success' ? | |
'✔ Todas las pruebas pasaron correctamente.' : | |
'❌ Las pruebas fallaron.'; | |
const comment = `Resultado de las pruebas:\n\n${testOutcome}`; | |
// Actualizar la descripción del pull request si es un PR | |
if (context.payload.pull_request) { | |
await github.rest.pulls.update({ | |
...context.repo, | |
pull_number: context.payload.pull_request.number, | |
body: (context.payload.pull_request.body || '') + `\n\n${comment}`, | |
}); | |
} else { | |
// Agregar un mensaje de estado para commits directos | |
await github.rest.repos.createCommitStatus({ | |
...context.repo, | |
sha: context.sha, | |
state: testOutcome.includes('✔') ? 'success' : 'failure', | |
description: testOutcome, | |
context: 'Resultados de las pruebas', | |
}); | |
} |