Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
Update to include all the current tests
  • Loading branch information
RobertBendun committed Jun 8, 2023
2 parents 3afe606 + 584beb4 commit 5bb6dc2
Show file tree
Hide file tree
Showing 49 changed files with 24,609 additions and 541 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and test Musique
on: [push]
jobs:
build-ubuntu-legacy:
name: "Builds on Ubuntu 20.04"
runs-on: ubuntu-20.04
steps:
- name: Install initial dependencies
run: "sudo apt update && sudo apt install -y make software-properties-common zip unzip git; sudo add-apt-repository ppa:ubuntu-toolchain-r/test"

- name: Install build dependencies
run: "sudo apt install -y gcc-11 g++-11 libasound2-dev lcov"

- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Checkout repository
uses: actions/checkout@v2

- name: Build release executable
run: "make CC=gcc-11 CXX=g++-11"

build-ubuntu-latest:
name: "Fully test Ubuntu 22.04"
runs-on: ubuntu-22.04
steps:
- name: Install build dependencies
run: "sudo apt install -y libasound2-dev lcov"

- name: Checkout repository
uses: actions/checkout@v2

- name: Build release executable
run: "make"

- name: Build unit tests executable
run: "CXXFLAGS=--coverage make mode=unit-test"

- name: Execute unit tests
run: "bin/linux/unit-test/musique"

- name: Execute regression tests
run: "CXXFLAGS=--coverage make test"

- name: Generate coverage info
run: "scripts/coverage.sh ci"

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v1
with:
path-to-lcov: coverage.info


build-macos:
name: "Build and regression test on macOS"
runs-on: macos-13
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Build
run: "make"

- name: Execute regression tests
run: "make test"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ release_*
*.html
link_hut
*.exe
coverage.info
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,45 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Types of changes

- __Added__ for new features.
- __Changed__ for changes in existing functionality.
- __Deprecated__ for soon-to-be removed features.
- __Removed__ for now removed features.
- __Fixed__ for any bug fixes.
- __Security__ in case of vulnerabilities.


## [Unreleased]

### Added

- Internal parameter for listing tokens: `musique tokens`

## [0.6.0] - 2023-06-09

### Added

- Builtin `seed` to provide seed for all functions using random number generation
- New `make` target: `full` - make everything that can be made for local developement
- `time` REPL command for measurement of execution time
- Unit testing strikes again! `make mode=unit-test`
- Continuous Integration with Github Actions
- [Musical Symbols Unicode block](https://en.wikipedia.org/wiki/Musical_Symbols_(Unicode_block)) can be used as an identifiers
- by default they are lengths of notes and rests appropiate for given symbol

### Changed

- Simplified `make` definition, `make mode=debug` for debug builds
- More regression tests

### Fixed

- function documentation generator proper cmdline parameter handling
- deterministic random number generation is now cross platform (setting the same seed on different platforms gives the same results)
- `nprimes 1` returns correctly `(2)`

## [0.5.0] - 2023-03-05

### Added
Expand Down
30 changes: 14 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ include config.mk
Sources := $(shell find musique/ -name '*.cc')
Obj := $(subst musique/,,$(Sources:%.cc=%.o))

ifeq ($(os),windows)
all: bin/musique.exe
debug: bin/windows/debug/musique.exe
else
all: bin/musique
debug: bin/$(os)/debug/musique
endif

include scripts/$(os).mk
include scripts/build.mk
include scripts/test.mk

all: $(PREFIX)/$(Target)

full: doc/musique-vs-languages-cheatsheet.html doc/wprowadzenie.html doc/functions.html
make all os=$(os)
make all os=$(os) mode=debug
make all os=$(os) mode=unit-test

bin/$(Target): bin/$(os)/$(Target)
ln -f $< $@
Expand All @@ -27,9 +25,6 @@ doc-open: doc
clean:
rm -rf bin coverage

release: bin/musique
scripts/release

install: bin/musique
scripts/install

Expand All @@ -40,16 +35,19 @@ doc/wprowadzenie.html: doc/wprowadzenie.md
pandoc -o $@ $< -s --toc

doc/functions.html: musique/interpreter/builtin_functions.cc scripts/document-builtin.py
scripts/document-builtin.py -o $@ $<
scripts/document-builtin.py -o $@ -f html $<

musique.zip:
docker build -t musique-builder --build-arg "VERSION=$(VERSION)" .
docker create --name musique musique-builder
docker cp musique:/musique.zip musique.zip
docker rm -f musique

.PHONY: clean doc doc-open all test unit-tests release install musique.zip
test:
make mode=debug
python3 scripts/test.py

.PHONY: clean doc doc-open all test unit-tests release install musique.zip full release

$(shell mkdir -p $(subst musique/,bin/$(os)/,$(shell find musique/* -type d)))
$(shell mkdir -p bin/$(os)/replxx/)
$(shell mkdir -p $(subst musique/,bin/$(os)/debug/,$(shell find musique/* -type d)))
$(shell mkdir -p $(subst musique/,$(PREFIX)/,$(shell find musique/* -type d)))
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Musique interpreter
# Musique

[![Build and test Musique](https://github.com/RobertBendun/musique/actions/workflows/build.yml/badge.svg)](https://github.com/RobertBendun/musique/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/RobertBendun/musique/badge.svg?branch=main)](https://coveralls.io/github/RobertBendun/musique?branch=main)

Reference implementation of Musique programming language.

## Building

Reference [`build_instructions.md`](./build_instructions.md).
You can find prebuild releases [here](https://musique.students.wmi.amu.edu.pl/).

## Syntax highlighting

Expand All @@ -29,8 +33,8 @@ Copy [editor/vscode-musique](editor/vscode-musique) directory to `<user home>/.v
# Thanks to

- Creator of [tl::expected](https://github.com/TartanLlama/expected) - [Sy Brand](https://sybrand.ink/)
- Creator of [bestline](https://github.com/jart/bestline) - [Justine Tunney](https://justinetunney.com/)
- Creator of [rtmidi](https://github.com/thestk/rtmidi/) - [Gary P. Scavone](http://www.music.mcgill.ca/~gary/)
- Creators of [link](https://github.com/Ableton/link)
- Creators of [Catch2](https://github.com/catchorg/Catch2/)

and all contributors that created libraries above.
30 changes: 25 additions & 5 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)"

MAJOR := 0
MINOR := 5
MINOR := 6
PATCH := 0
COMMIT := gc$(shell git rev-parse --short HEAD 2>/dev/null)

Expand All @@ -11,11 +11,11 @@ endif

VERSION := $(MAJOR).$(MINOR).$(PATCH)-dev+$(COMMIT)

CXXFLAGS:=$(CXXFLAGS) -std=c++20 -Wall -Wextra -Werror=switch -Werror=return-type -Werror=unused-result
CPPFLAGS:=$(CPPFLAGS) -DMusique_Version='"$(VERSION)"' \
CXXFLAGS := $(CXXFLAGS) -std=c++20 -Wall -Wextra -Werror=switch -Werror=return-type -Werror=unused-result
CPPFLAGS := $(CPPFLAGS) -DMusique_Version='"$(VERSION)"' \
-Ilib/expected/ -I. -Ilib/rtmidi/ -Ilib/link/include -Ilib/asio/include/ -Ilib/edit_distance.cc/ -Ilib/replxx/include -DREPLXX_STATIC
LDFLAGS=-flto
LDLIBS= -lpthread
LDFLAGS =-flto=auto
LDLIBS = -lpthread

RELEASE_FLAGS=-O2
DEBUG_FLAGS=-O0 -ggdb -fsanitize=undefined -DDebug
Expand All @@ -26,3 +26,23 @@ else
os=linux
endif

ifeq ($(mode),debug)

PREFIX = bin/$(os)/debug
CXXFLAGS += $(DEBUG_FLAGS)

else ifeq ($(mode),unit-test)

PREFIX = bin/$(os)/unit-test
CXXFLAGS += $(DEBUG_FLAGS) -DMUSIQUE_UNIT_TESTING
CPPFLAGS += -Ilib/Catch2/
MAIN = lib/Catch2/catch_amalgamated.cpp

else

PREFIX = bin/$(os)
CXXFLAGS += $(RELEASE_FLAGS)

endif


2 changes: 1 addition & 1 deletion editor/musique.vim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ syn match musiqueInteger display "[0-9][0-9_]*"

syn keyword musiqueConstant true false nil

syn keyword musiqueDefaultBuiltins bpm call ceil chord down flat floor fold for hash if incoming instrument len max min mix note_off note_on nprimes oct par partition permute pgmchange play program_change range reverse rotate round shuffle sim sort try typeof uniq unique up update
syn keyword musiqueDefaultBuiltins bpm call ceil chord down flat floor fold for hash if incoming instrument len max min mix note_off note_on nprimes oct par partition permute pgmchange play program_change range reverse rotate round shuffle sim sort try typeof uniq unique up update scan map
syn keyword musiqueLinuxBuiltins say

syn match musiqueComment "--.*$"
Expand Down
23 changes: 23 additions & 0 deletions lib/Catch2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 5bb6dc2

Please sign in to comment.