From 23efd305d86b3ba8096bec5126fa46f54fcceede Mon Sep 17 00:00:00 2001 From: Matus Horvath Date: Tue, 5 Mar 2024 19:40:40 +0100 Subject: [PATCH] Run CI/CD on Linux, Windows and MacOS --- .github/workflows/build.yml | 22 +++++++++++++++++++--- Makefile | 8 ++++---- src/bin2obj.s | 4 ++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d31e62..281e21c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,14 +8,18 @@ on: jobs: build: - name: Build and Test - runs-on: ubuntu-latest + name: OS=${{ matrix.os }} + runs-on: ${{ matrix.os }} env: ICDIR: xzintbit MSBASICDIR: msbasic FUNCTESTDIR: 6502_65C02_functional_tests + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: - uses: actions/checkout@v4 @@ -27,6 +31,8 @@ jobs: - name: Build xzintbit working-directory: xzintbit + env: + CC: gcc run: make build-vm - name: Checkout Microsoft Basic @@ -36,11 +42,20 @@ jobs: path: msbasic - name: Install cc65 - run: sudo apt install -y cc65 + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt install -y cc65 + elif [ "$RUNNER_OS" == "Windows" ]; then + choco install cc65-compiler + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install cc65 + fi + shell: bash - name: Build Microsoft Basic working-directory: msbasic run: ./make.sh + shell: bash - name: Checkout 6502 functional tests uses: actions/checkout@v4 @@ -50,6 +65,7 @@ jobs: - name: Build run: make build + shell: bash - name: Test run: make test diff --git a/Makefile b/Makefile index 642d458..60b970b 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,15 @@ MSBASICDIR ?= $(abspath ../msbasic) FUNCTESTDIR ?= $(abspath ../6502_65C02_functional_tests) ifeq ($(shell test -d $(ICDIR) || echo error),error) -$(error ICDIR variable is invalid; point it where https://github.com/matushorvath/xzintbit is built) + $(error ICDIR variable is invalid; point it where https://github.com/matushorvath/xzintbit is built) endif ifeq ($(shell test -d $(MSBASICDIR) || echo error),error) -$(error MSBASICDIR variable is invalid; point it where https://github.com/matushorvath/msbasic is built) + $(error MSBASICDIR variable is invalid; point it where https://github.com/matushorvath/msbasic is built) endif ifeq ($(shell test -d $(FUNCTESTDIR) || echo error),error) -$(error FUNCTESTDIR variable is invalid; point it where https://github.com/Klaus2m5/6502_65C02_functional_tests is cloned) + $(error FUNCTESTDIR variable is invalid; point it where https://github.com/Klaus2m5/6502_65C02_functional_tests is cloned) endif ICVM ?= $(abspath $(ICDIR)/vms)/$(ICVM_TYPE)/ic @@ -42,7 +42,7 @@ define run-ld endef define run-bin2obj - ls -n $< | awk '{ print $$5 }' | cat - $< | $(ICVM) $(BINDIR)/bin2obj.input > $@ + ls -n $< | awk '{ printf $$5" " }' | cat - $< | $(ICVM) $(BINDIR)/bin2obj.input > $@ || ( cat $@ ; false ) endef # Build diff --git a/src/bin2obj.s b/src/bin2obj.s index 91fea0c..cc4a268 100644 --- a/src/bin2obj.s +++ b/src/bin2obj.s @@ -7,7 +7,7 @@ # db , , ... # File data, bytes, each from 0 to 255 # Since Intcode has no way of detecting end of file, this utility expects the file size followed -# by a new line (ASCII 10) to be passed through the standard input before the binary itself. +# by a space to be passed through the standard input before the binary itself. .IMPORT print_num .IMPORT print_str @@ -20,7 +20,7 @@ read_size_loop: # Read file size in [digit] - eq [digit], 10, [tmp] + eq [digit], ' ', [tmp] jnz [tmp], read_size_done lt [digit], '0', [tmp] jnz [tmp], invalid_size