diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..1aa35c3 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,38 @@ +name: Run RScons Tests + +on: + push: + branches: + - master + pull_request: + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + ruby-version: ['2.7', '3.0', '3.4'] + + steps: + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y gcc gdc ldc clang flex bison + + - name: Install dependencies (macOS) + if: runner.os == 'macOS' + run: brew install gcc ldc flex bison + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + + - name: Install dependencies + run: bundle install + + - name: Run tests + run: rake all diff --git a/build_tests/two_sources/assuffix.rb b/build_tests/two_sources/assuffix.rb index 7803b97..df6d5d4 100644 --- a/build_tests/two_sources/assuffix.rb +++ b/build_tests/two_sources/assuffix.rb @@ -3,5 +3,5 @@ env do |env| env["CFLAGS"] += %w[-S] env.Object("one.ssss", "one.c", "CPPFLAGS" => ["-DONE"]) env.Object("two.sss", "two.c") - env.Program("two_sources.exe", %w[one.ssss two.sss], "ASFLAGS" => env["ASFLAGS"] + %w[-x assembler]) + env.Program("two_sources.exe", %w[one.ssss two.sss], "ASFLAGS" => env["ASFLAGS"] + %w[-x assembler-with-cpp]) end diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index 8d592ab..293a808 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -665,7 +665,7 @@ EOF expect(result.stdout).to eq "" end - unless RUBY_PLATFORM =~ /mingw|msys/ + unless RUBY_PLATFORM =~ /mingw|msys|darwin/ it "supports building D sources with gdc" do test_dir("d") result = run_rscons @@ -711,7 +711,7 @@ EOF expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!" end - unless RUBY_PLATFORM =~ /mingw|msys/ + unless RUBY_PLATFORM =~ /mingw|msys|darwin/ it "links with the D linker when object files were built from D sources" do test_dir("d") result = run_rscons(args: %w[-f link_objects.rb]) @@ -761,7 +761,7 @@ EOF result = run_rscons(args: %w[-f disassemble.rb]) expect(result.stderr).to eq "" expect(File.exist?("simple.txt")).to be_truthy - expect(File.read("simple.txt")).to match /Disassembly of section .text:/ + expect(File.read("simple.txt")).to match /Disassembly of section/ result = run_rscons(args: %w[-f disassemble.rb]) expect(result.stderr).to eq "" @@ -1211,7 +1211,7 @@ EOF %r{Compiling simple.c}, %r{My Disassemble simple.txt}, ]) - expect(File.read("simple.txt")).to match /Disassembly of section .text:/ + expect(File.read("simple.txt")).to match /Disassembly of section/ end end @@ -2024,7 +2024,7 @@ EOF {"check_d_compiler.rb" => "when no arguments are given", "check_d_compiler_find_first.rb" => "when arguments are given"}.each_pair do |rsconscript, desc| context desc do - unless RUBY_PLATFORM =~ /mingw|msys/ + unless RUBY_PLATFORM =~ /mingw|msys|darwin/ it "finds the first listed D compiler" do test_dir "configure" result = run_rscons(args: %W[-f #{rsconscript} configure]) @@ -2056,18 +2056,18 @@ EOF end end - it "respects use flag" do - test_dir "configure" - result = run_rscons(args: %w[-f check_d_compiler_use.rb -v]) - expect(result.stderr).to eq "" - expect(result.status).to eq 0 - expect(result.stdout).to match %r{\bgdc .*/t1/} - expect(result.stdout).to_not match %r{\bldc2 .*/t1/} - expect(result.stdout).to match %r{\bldc2 .*/t2/} - expect(result.stdout).to_not match %r{\bgdc .*/t2/} - end + unless RUBY_PLATFORM =~ /mingw|msys|darwin/ + it "respects use flag" do + test_dir "configure" + result = run_rscons(args: %w[-f check_d_compiler_use.rb -v]) + expect(result.stderr).to eq "" + expect(result.status).to eq 0 + expect(result.stdout).to match %r{\bgdc .*/t1/} + expect(result.stdout).to_not match %r{\bldc2 .*/t1/} + expect(result.stdout).to match %r{\bldc2 .*/t2/} + expect(result.stdout).to_not match %r{\bgdc .*/t2/} + end - unless RUBY_PLATFORM =~ /mingw|msys/ it "successfully tests a compiler with an unknown name that uses gdc-compatible options" do test_dir "configure" create_exe "mycompiler", %[exec gdc "$@"]