Add LLVM and npiet jobs for macos #19
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: Rust | |
| on: | |
| push: | |
| branches: [ main, tests, ci ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| rust: [stable, beta] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install LLVM | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 18 | |
| sudo apt-get install -y llvm-18-dev libpolly-18-dev | |
| - name: Install LLVM (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install llvm@18 | |
| echo "LLVM_SYS_180_PREFIX=$(brew --prefix llvm@18)" >> $GITHUB_ENV | |
| echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH | |
| - name: Install npiet (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt install libgd-dev groff | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Install npiet (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install gd groff | |
| export CFLAGS="-I$(brew --prefix)/include" | |
| export LDFLAGS="-L$(brew --prefix)/lib" | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Run integration tests | |
| run: cargo test --test '*' | |
| lint: | |
| name: Linting (rustfmt + clippy) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Install LLVM | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 18 | |
| sudo apt-get install -y llvm-18-dev libpolly-18-dev | |
| - name: Install LLVM (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install llvm@18 | |
| echo "LLVM_SYS_180_PREFIX=$(brew --prefix llvm@18)" >> $GITHUB_ENV | |
| echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH | |
| - name: Run rustfmt | |
| run: cargo fmt -- --check | |
| - name: Install npiet (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt install libgd-dev groff | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Install npiet (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install gd groff | |
| export CFLAGS="-I$(brew --prefix)/include" | |
| export LDFLAGS="-L$(brew --prefix)/lib" | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| build: | |
| name: Build Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install LLVM | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 18 | |
| sudo apt-get install -y llvm-18-dev libpolly-18-dev | |
| - name: Install LLVM (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install llvm@18 | |
| echo "LLVM_SYS_180_PREFIX=$(brew --prefix llvm@18)" >> $GITHUB_ENV | |
| echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH | |
| - name: Install npiet (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt install libgd-dev groff | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Install npiet (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install gd groff | |
| export CFLAGS="-I$(brew --prefix)/include" | |
| export LDFLAGS="-L$(brew --prefix)/lib" | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Check compilation | |
| run: cargo check --all-targets | |
| - name: Build in release mode | |
| run: cargo build --release | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install npiet (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt install libgd-dev groff | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Install npiet (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install gd groff | |
| export CFLAGS="-I$(brew --prefix)/include" | |
| export LDFLAGS="-L$(brew --prefix)/lib" | |
| git clone https://github.com/gleitz/npiet.git && cd npiet | |
| ./configure | |
| make | |
| sudo make install | |
| - name: Install LLVM | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 18 | |
| sudo apt-get install -y llvm-18-dev libpolly-18-dev | |
| - name: Install LLVM (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install llvm@18 | |
| echo "LLVM_SYS_180_PREFIX=$(brew --prefix llvm@18)" >> $GITHUB_ENV | |
| echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH | |
| - name: Install cargo-tarpaulin | |
| run: cargo install cargo-tarpaulin | |
| - name: Generate coverage | |
| run: cargo tarpaulin --verbose --all-features --workspace --timeout 300 --out xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./cobertura.xml | |
| fail_ci_if_error: false |