[test]: workflow #6
Workflow file for this run
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: [ main, feat/*, 3-feat-ci-add-build-workflow ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake | |
| # Install LLVM and Clang 19 | |
| wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
| sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | |
| sudo apt-get update | |
| sudo apt-get install -y llvm-19 llvm-19-dev clang-19 libclang-19-dev | |
| echo "LLVM_DIR=/usr/lib/llvm-19/lib/cmake/llvm" >> $GITHUB_ENV | |
| echo "Clang_DIR=/usr/lib/llvm-19/lib/cmake/clang" >> $GITHUB_ENV | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install cmake llvm@19 | |
| echo "LLVM_DIR=$(brew --prefix llvm@19)/lib/cmake/llvm" >> $GITHUB_ENV | |
| echo "Clang_DIR=$(brew --prefix llvm@19)/lib/cmake/clang" >> $GITHUB_ENV | |
| echo "$(brew --prefix llvm@19)/bin" >> $GITHUB_PATH | |
| - name: Configure and Build (Linux/macOS) | |
| if: runner.os == 'Linux' || runner.os == 'macOS' | |
| run: | | |
| mkdir -p build && cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release \ | |
| -DLLVM_DIR=${{ env.LLVM_DIR }} \ | |
| -DClang_DIR=${{ env.Clang_DIR }} \ | |
| -DUSE_SHARED_LIB=OFF \ | |
| -DBUILD_TESTS=OFF | |
| cmake --build . --config Release | |
| - name: Test compiler (Linux/macOS) | |
| if: runner.os == 'Linux' || runner.os == 'macOS' | |
| run: | | |
| cd build | |
| echo 'int main() { return 0; }' > test.cc | |
| ./cc -S -emit-llvm test.cc | |
| # Vérifier que le fichier LLVM IR a été généré | |
| if [ -f "test.ll" ]; then | |
| echo "Test réussi: Fichier LLVM IR généré avec succès" | |
| cat test.ll | head -n 10 | |
| else | |
| echo "Test échoué: Fichier LLVM IR non généré" | |
| exit 1 | |
| fi |