Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility profiles for CI #11726

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,31 @@ jobs:
- name: Test std specs with interpreter
run: bin/ci with_build_env 'bin/crystal i spec/interpreter_std_spec.cr'

test_compatibility:
env:
ARCH: ${{ matrix.arch }}
ARCH_CMD: linux64
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- x86_64
profile:
- current
- legacy
steps:
- name: Download Crystal source
uses: actions/checkout@v2

- name: Prepare System
run: bin/ci prepare_system

- name: Prepare Build
run: bin/ci prepare_build

- name: Test
run: bin/ci with_build_env 'make crystal std_spec primitives_spec samples profile=${{ matrix.profile }}'

check_format:
env:
ARCH: x86_64
Expand Down
33 changes: 21 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,30 @@
CRYSTAL ?= crystal ## which previous crystal compiler use
LLVM_CONFIG ?= ## llvm-config command path to use

release ?= ## Compile in release mode
stats ?= ## Enable statistics output
progress ?= ## Enable progress output
threads ?= ## Maximum number of threads to use
debug ?= ## Add symbolic debug info
verbose ?= ## Run specs in verbose mode
junit_output ?= ## Path to output junit results
static ?= ## Enable static linking
interpreter ?= ## Enable interpreter feature
check ?= ## Enable only check when running format
release ?= ## Compile in release mode
stats ?= ## Enable statistics output
progress ?= ## Enable progress output
threads ?= ## Maximum number of threads to use
debug ?= ## Add symbolic debug info
verbose ?= ## Run specs in verbose mode
junit_output ?= ## Path to output junit results
static ?= ## Enable static linking
interpreter ?= ## Enable interpreter feature
check ?= ## Enable only check when running format
profile ?= future## Compatibility profile (future|current|legacy)

ifeq ($(profile),future)
LANG_FLAGS := -Dstrict_multi_assign
else ifeq ($(profile),legacy)
LANG_FLAGS := -Dno_number_autocast
else ifneq ($(profile),current)
$(error Expected profile to be one of 'future', 'current', or 'legacy', got: $(profile))
endif

O := .build
SOURCES := $(shell find src -name '*.cr')
SPEC_SOURCES := $(shell find spec -name '*.cr')
override FLAGS += -D strict_multi_assign $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )$(if $(target),--cross-compile --target $(target) )$(if $(interpreter),,-Dwithout_interpreter )
override FLAGS += $(LANG_FLAGS) $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )$(if $(target),--cross-compile --target $(target) )$(if $(interpreter),,-Dwithout_interpreter )
SPEC_WARNINGS_OFF := --exclude-warnings spec/std --exclude-warnings spec/compiler --exclude-warnings spec/primitives
SPEC_FLAGS := $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )
CRYSTAL_CONFIG_LIBRARY_PATH := '$$ORIGIN/../lib/crystal'
Expand Down Expand Up @@ -101,7 +110,7 @@ smoke_test: $(O)/std_spec $(O)/compiler_spec $(O)/crystal

.PHONY: samples
samples: ## Build example programs
$(MAKE) -C samples
$(MAKE) -C samples FLAGS=$(LANG_FLAGS)

.PHONY: docs
docs: ## Generate standard library documentation
Expand Down
5 changes: 3 additions & 2 deletions samples/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CRYSTAL := ../bin/crystal## Crystal compiler to use
O := .build## Output directory
FLAGS ?=## Additional compiler flags

BUILDABLE_SOURCES := $(wildcard *.cr llvm/*.cr compiler/*.cr)
NONLINK_SOURCES := $(wildcard sdl/*.cr)
Expand All @@ -15,11 +16,11 @@ build: $(BUILDABLE_BINARIES) $(NONLINK_BINARIES) ## Build sample binaries

$(O)/%: %.cr
mkdir -p $(shell dirname $@)
$(CRYSTAL) build $< -o $@
$(CRYSTAL) build $(FLAGS) $< -o $@

$(O)/%.o: %.cr
mkdir -p $(shell dirname $@)
$(CRYSTAL) build --cross-compile $< -o $(patsubst %.o,%,$@)
$(CRYSTAL) build $(FLAGS) --cross-compile $< -o $(patsubst %.o,%,$@)

.PHONY: clean
clean: ## Remove build artifacts
Expand Down