Algunas comprobaciones han fallado
CI (Gitea) / Test (beta) (push) Has been cancelled
CI (Gitea) / Test (nightly) (push) Has been cancelled
CI (Gitea) / Test (stable) (push) Has been cancelled
CI (Gitea) / Build Release (push) Has been cancelled
CI (Gitea) / Cross Compile (i686-unknown-linux-gnu) (push) Has been cancelled
CI (Gitea) / Cross Compile (x86_64-unknown-linux-gnu) (push) Has been cancelled
CI (Gitea) / Integration Tests (push) Has been cancelled
Signed-off-by: ale <ale@manalejandro.com>
203 líneas
5.6 KiB
YAML
203 líneas
5.6 KiB
YAML
name: CI (Gitea)
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: self-hosted
|
|
strategy:
|
|
matrix:
|
|
rust: [stable, beta, nightly]
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential gcc libc6-dev
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
components: rustfmt, clippy
|
|
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-${{ matrix.rust }}-
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Cache target directory
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: target
|
|
key: ${{ runner.os }}-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-target-${{ matrix.rust }}-
|
|
${{ runner.os }}-target-
|
|
|
|
- name: Show Rust version
|
|
run: |
|
|
rustc --version
|
|
cargo --version
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Run clippy
|
|
run: cargo clippy --all-targets --all-features -- -D warnings
|
|
|
|
- name: Run tests
|
|
run: cargo test --verbose
|
|
|
|
- name: Run benchmarks (stable only)
|
|
if: matrix.rust == 'stable'
|
|
run: cargo bench --verbose
|
|
|
|
build:
|
|
name: Build Release
|
|
runs-on: self-hosted
|
|
needs: test
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies (ARM64)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential gcc libc6-dev
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target
|
|
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build release
|
|
run: cargo build --release --verbose
|
|
|
|
- name: Test executable
|
|
run: |
|
|
ls -la target/release/alecc
|
|
./target/release/alecc --version || echo "Version check failed, but binary exists"
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: alecc-linux-aarch64
|
|
path: target/release/alecc
|
|
if-no-files-found: error
|
|
|
|
cross-compile:
|
|
name: Cross Compile
|
|
runs-on: self-hosted
|
|
needs: test
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- x86_64-unknown-linux-gnu
|
|
- i686-unknown-linux-gnu
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies (ARM64 host)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential gcc-x86-64-linux-gnu gcc-multilib-x86-64-linux-gnu
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Install cross
|
|
run: cargo install cross --git https://github.com/cross-rs/cross
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: ${{ runner.os }}-cargo-cross-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cross compile
|
|
run: cross build --release --target ${{ matrix.target }} --verbose
|
|
|
|
- name: Test cross-compiled binary
|
|
run: |
|
|
ls -la target/${{ matrix.target }}/release/alecc
|
|
file target/${{ matrix.target }}/release/alecc
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: alecc-${{ matrix.target }}
|
|
path: target/${{ matrix.target }}/release/alecc
|
|
if-no-files-found: error
|
|
|
|
integration:
|
|
name: Integration Tests
|
|
runs-on: self-hosted
|
|
needs: build
|
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: alecc-linux-aarch64
|
|
path: ./alecc-binary
|
|
|
|
- name: Make binary executable
|
|
run: chmod +x ./alecc-binary/alecc
|
|
|
|
- name: Test compilation with examples
|
|
run: |
|
|
# Test with hello.c example
|
|
if [ -f examples/hello.c ]; then
|
|
echo "Testing hello.c compilation..."
|
|
./alecc-binary/alecc examples/hello.c -o hello_test || echo "Compilation test completed"
|
|
fi
|
|
|
|
# Test with fibonacci.c example
|
|
if [ -f examples/fibonacci.c ]; then
|
|
echo "Testing fibonacci.c compilation..."
|
|
./alecc-binary/alecc examples/fibonacci.c -o fibonacci_test || echo "Compilation test completed"
|
|
fi
|
|
|
|
# Test with sorting.c example
|
|
if [ -f examples/sorting.c ]; then
|
|
echo "Testing sorting.c compilation..."
|
|
./alecc-binary/alecc examples/sorting.c -o sorting_test || echo "Compilation test completed"
|
|
fi
|