Skip to content

Commit

Permalink
makefile and CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
countvajhula committed Jun 8, 2021
1 parent a7f5d72 commit 03b40eb
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: build

on: [push, pull_request]

defaults:
run:
shell: bash

jobs:
test:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: true
matrix:
racket-variant: ['BC', 'CS']
racket-version: ['7.8', 'stable']
experimental: [false]
include:
- racket-version: 'current'
racket-variant: 'CS'
experimental: true
name: Test on Racket ${{ matrix.racket-variant }} ${{ matrix.racket-version }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install Racket
uses: Bogdanp/[email protected]
with:
architecture: 'x64'
distribution: 'full'
variant: ${{ matrix.racket-variant }}
version: ${{ matrix.racket-version }}
- name: Install Package and its Dependencies
run: make install
- name: Check Dependencies
run: make check-deps
- name: Run Tests
run: make test
coverage:
needs: test
runs-on: ubuntu-latest
name: Report Coverage
environment: test-env
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install Racket
uses: Bogdanp/[email protected]
with:
architecture: 'x64'
distribution: 'full'
variant: 'CS'
version: 'stable'
- name: Install Package and its Dependencies
run: make install
- name: Report Coverage
run: make cover-coveralls
82 changes: 82 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Adapted from: http://www.greghendershott.com/2017/04/racket-makefiles.html
PACKAGE-NAME=cli

DEPS-FLAGS=--check-pkg-deps --unused-pkg-deps

help:
@echo "install - install package along with dependencies"
@echo "remove - remove package"
@echo "build - Compile libraries"
@echo "build-docs - Build docs"
@echo "build-all - Compile libraries, build docs, and check dependencies"
@echo "clean - remove all build artifacts"
@echo "check-deps - check dependencies"
@echo "test - run tests"
@echo "test-with-errortrace - run tests with error tracing"
@echo "errortrace - alias for test-with-errortrace"
@echo "cover - Run test coverage checker and view report"
@echo "cover-coveralls - Run test coverage and upload to Coveralls"
@echo "coverage-check - Run test coverage checker"
@echo "coverage-report - View test coverage report"
@echo "docs - view docs in a browser"

# Primarily for use by CI.
# Installs dependencies as well as linking this as a package.
install:
raco pkg install --deps search-auto

remove:
raco pkg remove $(PACKAGE-NAME)

# Primarily for day-to-day dev.
# Build libraries from source.
build:
raco setup --no-docs --tidy --pkgs $(PACKAGE-NAME)

# Primarily for day-to-day dev.
# Build docs (if any).
build-docs:
raco setup --no-launcher --no-foreign-libs --no-info-domain --no-pkg-deps \
--no-install --no-post-install --tidy --pkgs $(PACKAGE-NAME)

# Primarily for day-to-day dev.
# Build libraries from source, build docs (if any), and check dependencies.
build-all:
raco setup --tidy $(DEPS-FLAGS) --pkgs $(PACKAGE-NAME)

# Note: Each collection's info.rkt can say what to clean, for example
# (define clean '("compiled" "doc" "doc/<collect>")) to clean
# generated docs, too.
clean:
raco setup --fast-clean --pkgs $(PACKAGE-NAME)

# Primarily for use by CI, after make install -- since that already
# does the equivalent of make setup, this tries to do as little as
# possible except checking deps.
check-deps:
raco setup --no-docs $(DEPS-FLAGS) $(PACKAGE-NAME)

# Suitable for both day-to-day dev and CI
test:
raco test -x -p $(PACKAGE-NAME)

test-with-errortrace:
racket -l errortrace -l racket -e '(require (submod "main.rkt" test))'

errortrace: test-with-errortrace

docs:
raco docs $(PACKAGE-NAME)

coverage-check:
raco cover -b -n dev -p $(PACKAGE-NAME)

coverage-report:
open coverage/index.html

cover: coverage-check coverage-report

cover-coveralls:
raco cover -b -n dev -f coveralls -p $(PACKAGE-NAME)

.PHONY: help install remove build build-docs build-all clean check-deps test test-with-errortrace errortrace docs cover coverage-check coverage-report cover-coveralls

0 comments on commit 03b40eb

Please sign in to comment.