diff --git a/.github/workflows/core_ci.yml b/.github/workflows/core_ci.yml new file mode 100644 index 0000000..6f8a6a8 --- /dev/null +++ b/.github/workflows/core_ci.yml @@ -0,0 +1,127 @@ +name: ci +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +defaults: + run: + working-directory: ./core + +jobs: + test: + name: test + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + toolchain: [stable] + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - aarch64-unknown-linux-gnu + - aarch64-unknown-linux-musl + - x86_64-apple-darwin + - x86_64-pc-windows-msvc + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + binary: x86-64 + cargo-tool: cargo + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + binary: x86-64 + cargo-tool: cross + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + binary: aarch64 + cargo-tool: cross + - os: ubuntu-latest + target: aarch64-unknown-linux-musl + binary: aarch64 + cargo-tool: cross + - os: macos-13 # intel + target: x86_64-apple-darwin + binary: x86_64 + cargo-tool: cargo + - os: macos-latest # aarch64 + toolchain: stable + target: aarch64-apple-darwin + binary: arm64 + cargo-tool: cargo + - os: windows-latest + target: x86_64-pc-windows-gnu + binary: x86-64 + cargo-tool: cargo + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + + - name: Run tests + uses: clechasseur/rs-cargo@v3 + with: + command: test + args: "--target ${{ matrix.target }}" + tool: ${{ matrix.cargo-tool }} + + fmt: + name: fmt + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: rustfmt + + - run: make fmt + + lint: + name: lint + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: clippy + + - name: Run linter + run: make lint + + build: + name: build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: clippy + + - name: Build + run: make build diff --git a/core/Makefile b/core/Makefile new file mode 100644 index 0000000..0bf89ae --- /dev/null +++ b/core/Makefile @@ -0,0 +1,16 @@ +CURRENT_DIR = $(shell pwd) + +build: + cargo build --all-features --release + +test: + KOMODO_STD=$(CURRENT_DIR)/../std/ sh test.sh $(CURRENT_DIR)/../examples + +lint: + cargo clippy --all-targets --all-features + +fmt: + cargo fmt --check + +repl: + KOMODO_STD=$(CURRENT_DIR)/../std/ cargo run --all-features --quiet