mirror of
https://github.com/dlang/tools.git
synced 2025-04-25 12:40:21 +03:00
CI: Add GitHub Actions workflow
This commit is contained in:
parent
aff0b60f3f
commit
b3bf04683e
3 changed files with 55 additions and 6 deletions
38
.github/workflows/main.yml
vendored
Normal file
38
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: Main
|
||||
on:
|
||||
- pull_request # without merge conflicts
|
||||
- push # branch or tag
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ macos-latest, ubuntu-latest, windows-latest ]
|
||||
dc: [ dmd-latest, ldc-latest ]
|
||||
name: ${{ matrix.os }}, ${{ matrix.dc }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
DMD: ${{ startsWith(matrix.dc, 'ldc') && 'ldmd2' || 'dmd' }}
|
||||
N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install D compiler
|
||||
uses: dlang-community/setup-dlang@v1.3.0
|
||||
with:
|
||||
compiler: ${{ matrix.dc }}
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: make -j$N DMD=$DMD
|
||||
- name: Test
|
||||
shell: bash
|
||||
run: make -j$N DMD=$DMD test
|
||||
- name: 'Windows: Build and test with MODEL=32'
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: make -j$N DMD=$DMD MODEL=32 all test
|
17
Makefile
17
Makefile
|
@ -97,12 +97,19 @@ $(ROOT)/tests_extractor$(DOTEXE): tests_extractor.d
|
|||
# Build & run tests
|
||||
################################################################################
|
||||
|
||||
ifeq (windows,$(OS))
|
||||
# for some reason, --strip-trailing-cr isn't enough - need to dos2unix stdin
|
||||
DIFF := dos2unix | diff --strip-trailing-cr
|
||||
else
|
||||
DIFF := diff
|
||||
endif
|
||||
|
||||
test_tests_extractor: $(ROOT)/tests_extractor$(DOTEXE)
|
||||
for file in ascii iteration ; do \
|
||||
$< -i "./test/tests_extractor/$${file}.d" | diff --strip-trailing-cr -p - "./test/tests_extractor/$${file}.d.ext"; \
|
||||
$< -i "./test/tests_extractor/$${file}.d" | $(DIFF) -u -p - "./test/tests_extractor/$${file}.d.ext"; \
|
||||
done
|
||||
$< -a betterc -i "./test/tests_extractor/attributes.d" | diff --strip-trailing-cr -p - "./test/tests_extractor/attributes.d.ext";
|
||||
$< --betterC -i "./test/tests_extractor/betterc.d" | diff --strip-trailing-cr -p - "./test/tests_extractor/betterc.d.ext";
|
||||
$< -a betterc -i "./test/tests_extractor/attributes.d" | $(DIFF) -u -p - "./test/tests_extractor/attributes.d.ext";
|
||||
$< --betterC -i "./test/tests_extractor/betterc.d" | $(DIFF) -u -p - "./test/tests_extractor/betterc.d.ext";
|
||||
|
||||
RDMD_TEST_COMPILERS = $(DMD)
|
||||
RDMD_TEST_EXECUTABLE = $(ROOT)/rdmd$(DOTEXE)
|
||||
|
@ -113,6 +120,10 @@ ifeq ($(VERBOSE_RDMD_TEST), 1)
|
|||
override VERBOSE_RDMD_TEST_FLAGS:=-v
|
||||
endif
|
||||
|
||||
ifeq (osx,$(OS))
|
||||
# /tmp is a symlink on Mac, and rdmd_test.d doesn't like it
|
||||
test_rdmd: export TMPDIR=$(shell cd /tmp && pwd -P)
|
||||
endif
|
||||
test_rdmd: $(ROOT)/rdmd_test$(DOTEXE) $(RDMD_TEST_EXECUTABLE)
|
||||
$< $(RDMD_TEST_EXECUTABLE) $(MODEL_FLAG) \
|
||||
--rdmd-default-compiler=$(RDMD_TEST_DEFAULT_COMPILER) \
|
||||
|
|
|
@ -431,7 +431,7 @@ void runTests(string rdmdApp, string compiler, string model)
|
|||
|
||||
res = execute(rdmdArgs ~ [forceSrc.baseName()]);
|
||||
enforce(res.status == 0, res.output);
|
||||
enforce(!res.output.canFind("compile_force_src"));
|
||||
enforce(!res.output.canFind("compile_force_src"), res.output);
|
||||
}
|
||||
|
||||
auto conflictDir = forceSrc.setExtension(".dir");
|
||||
|
@ -684,11 +684,11 @@ void runFallbackTest(string rdmdApp, string buildCompiler, string model)
|
|||
if an explicit --compiler flag is not provided, rdmd should
|
||||
search its own binary path first when looking for the default
|
||||
compiler (determined by the compiler used to build it) */
|
||||
string localDMD = buildPath(tempDir(), baseName(buildCompiler).setExtension(binExt));
|
||||
string localDMD = buildPath(dirName(rdmdApp), baseName(buildCompiler).setExtension(binExt));
|
||||
std.file.write(localDMD, ""); // An empty file avoids the "Not a valid 16-bit application" pop-up on Windows
|
||||
scope(exit) std.file.remove(localDMD);
|
||||
|
||||
auto res = execute(rdmdApp ~ [modelSwitch(model), "--force", "--chatty", "--eval=writeln(`Compiler found.`);"]);
|
||||
enforce(res.status == 1, res.output);
|
||||
enforce(res.output.canFind(format(`spawn [%(%s%),`, localDMD.only)), localDMD ~ " would not have been executed");
|
||||
enforce(res.output.canFind(format(`spawn [%(%s%),`, localDMD.only)), localDMD ~ " would not have been executed. Output:\n" ~ res.output);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue