Skip to content

Commit

Permalink
ci: Add VM code coverage (#17)
Browse files Browse the repository at this point in the history
* Try code coverage

* Install tarpaulin in deps

* Add secret?

* Fix typo

* Try this

* fix: Remove redundant action step

* fix: Correct typo in name of VM crate

* docs: Add README coverage badge

* ci: Use cargo binstall for faster install

* fix: Use correct Makefile whitespace
  • Loading branch information
ethanuppal authored Jan 13, 2025
1 parent a792817 commit f56dbd8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Coverage

on:
pull_request:
push:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Rust Caching
uses: Swatinem/rust-cache@v2.7.3
- name: Install dependencies
run: make deps
- name: Check coverage
run: make test_cov_vm COVERALLS=${{ secrets.COVERALLS_REPO_TOKEN }}
# - name: Coveralls
# uses: coverallsapp/github-action@v2
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
# currently a hack until I get it working on Apple Silicon

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
RUST_PREFIX := rustup run stable-x86_64-apple-darwin
endif

ifeq ($(UNAME), Darwin)
PREFIX := rustup run stable-x86_64-apple-darwin
NATIVE_PREFIX := arch -x86_64
endif

.PHONY: test_native
Expand All @@ -15,22 +20,24 @@ deps:
ifeq ($(UNAME), Darwin)
rustup toolchain install stable-x86_64-apple-darwin
endif
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall cargo-tarpaulin

.PHONY: test
test:
$(PREFIX) cargo test
$(RUST_PREFIX) cargo test

.PHONY: test_cov_vm
test_cov_vm:
$(RUST_PREFIX) cargo tarpaulin -p fern-vm --coveralls $(COVERALLS)

.PHONY: build
build:
$(PREFIX) cargo build
$(RUST_PREFIX) cargo build

.PHONY: run
run: build
ifeq ($(UNAME), Darwin)
arch -x86_64 target/debug/fernjit
else
target/debug/fernjit
endif
$(NATIVE_PREFIX) target/debug/fernjit

.PHONY: asm
asm:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

![CI](https://github.com/ethanuppal/fernjit/actions/workflows/ci.yaml/badge.svg)
![Code Style](https://github.com/ethanuppal/fernjit/actions/workflows/lint.yaml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/ethanuppal/fernjit/badge.svg?branch=main)](https://coveralls.io/github/ethanuppal/fernjit?branch=main)

[Utku](https://utku.sh) and I are writing a JIT compiler for a bytecode runtime (tentatively called "fern") to learn about how JITs work!

0 comments on commit f56dbd8

Please # to comment.