Compare commits

...

8 Commits

Author SHA1 Message Date
WebFreak001 1498ef1c1c update CI 2025-10-18 22:15:27 +02:00
WebFreak001 a739fffce0 generate OSX ARM binaries 2025-10-18 22:15:27 +02:00
Andrei Horodniceanu bd139c63d5 tests/extra/tc_ufcs_all_kinds: enforce a consistent locale
gdc can output error messages in the system language which can break
the regex mactches the code relies on.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu c79850d38e dsymbol/tests.d: Increase memory threshold approximation
out of 200 runs 26 were above the current 5000 threshold, with the
highest being 5279.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu 3b1f0abfd8 CI: test gdc
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu 45117876d8 tests/extra/tc_ufcs_all_kinds: support gdc
Change the format in which errors are printed to keep it consistent
across all the three major compilers (a style that they all support is
the gnu style) and make the matching code in generate_tests.d more
readable by using a regex.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu dd28e52ec1 CI: use setup-dlang v2
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu 264c5ef6a9 CI: update ubuntu version
ubuntu-20.04 has been retired

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
10 changed files with 84 additions and 35 deletions

View File

@ -5,3 +5,8 @@ indent_size = 4
tab_width = 4
trim_trailing_whitespace = true
indent_style = tab
[.github/workflows/*.yml]
indent_size = 2
tab_width = 2
indent_style = space

View File

@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
# use older ubuntu / linux version for glibc compatibility
os: [ubuntu-20.04, windows-latest, macos-latest]
os: [ubuntu-22.04, windows-latest]
dc:
- ldc-latest
- dmd-latest
@ -27,20 +27,48 @@ jobs:
dc: ldc-latest
build: debug
libdparse-version: min
# macos only with LDC
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: debug, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: release, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: debug, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: release, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: debug, arch: aarch64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: release, arch: aarch64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: debug, arch: aarch64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: release, arch: aarch64 }
# old compiler tests
- { os: ubuntu-20.04, dc: dmd-2.095.1, libdparse-version: min, build: debug, arch: x86_64 }
- { os: ubuntu-20.04, dc: ldc-1.25.0, libdparse-version: min, build: debug, arch: x86_64 }
- { os: ubuntu-22.04, dc: dmd-2.095.1, libdparse-version: min, build: debug, arch: x86_64 }
- { os: ubuntu-22.04, dc: ldc-1.25.0, libdparse-version: min, build: debug, arch: x86_64 }
# gdc
- { os: ubuntu-24.04, dc: gdc-14, libdparse-version: min, build: debug, arch: x86_64 }
- { os: ubuntu-24.04, dc: gdc-14, libdparse-version: max, build: debug, arch: x86_64 }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup D tools (gdc only)
if: ${{ startsWith(matrix.dc, 'gdc') }}
uses: dlang-community/setup-dlang@v2
- name: Setup D
uses: dlang-community/setup-dlang@v1
uses: dlang-community/setup-dlang@v2
with:
compiler: ${{ matrix.dc }}
- name: Set gdc specific environment variables
if: ${{ startsWith(matrix.dc, 'gdc') }}
run: |
tee -a ${GITHUB_ENV} <<<"DC=${DMD}" # need gdmd for -run
# Linking errors without -allinst
# No other easy way to pass this to dub, using DFLAGS in the
# environment disables unittests
cat <<-EOF | sudo tee -a /etc/dmd.conf
[Environment]
DFLAGS=-allinst
EOF
# Build
- name: Build
@ -52,7 +80,6 @@ jobs:
- name: Build DSymbol
env:
DC: ${{matrix.dc}}
LIBDPARSE_VERSION: ${{ matrix.libdparse-version }}
run: |
cd dsymbol
@ -60,7 +87,6 @@ jobs:
- name: Test DSymbol
env:
DC: ${{matrix.dc}}
LIBDPARSE_VERSION: ${{ matrix.libdparse-version }}
run: |
cd dsymbol

View File

@ -10,7 +10,7 @@ on:
jobs:
intro_comment:
name: Make intro comment
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: 'Prepare sticky comment'
# commit of v2.5.0

View File

@ -9,24 +9,22 @@ on:
jobs:
comment:
name: PR Info
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
# from https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
uses: actions/github-script@v8
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
var { data: artifacts } = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var matchArtifact = artifacts.artifacts.filter((artifact) => artifact.name === "pr")[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,

View File

@ -18,12 +18,12 @@ jobs:
# Compiler to test with
- name: Prepare compiler
uses: dlang-community/setup-dlang@v1
uses: dlang-community/setup-dlang@v2
with:
compiler: dmd-latest
- name: Prepare compiler
uses: dlang-community/setup-dlang@v1
uses: dlang-community/setup-dlang@v2
with:
compiler: ldc-latest

View File

@ -9,11 +9,14 @@ jobs:
fail-fast: false
matrix:
# use older ubuntu / linux version for glibc compatibility
os: [ubuntu-20.04, windows-latest, macos-latest]
os: [ubuntu-22.04, windows-latest]
dc:
- ldc-latest
arch:
- x86_64
include:
- os: macos-latest
arch: aarch64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
@ -21,7 +24,7 @@ jobs:
submodules: recursive
- name: Setup D
uses: dlang-community/setup-dlang@v1
uses: dlang-community/setup-dlang@v2
with:
compiler: ${{ matrix.dc }}

2
.gitignore vendored
View File

@ -31,6 +31,8 @@ stdout.txt
# script-generated expected with absolute file paths
tests/tc_locate_ufcs_function/expected.txt
tests/tc_recursive_public_import/expected.txt
# other script-generated files
tests/extra/tc_ufcs_all_kinds/generate_tests
# Dub files
.dub

View File

@ -576,7 +576,7 @@ version (linux) unittest
}
const rssAfter = getRSS();
// check the process memory increase with some eyeballed threshold
assert(rssAfter - rssBefore < 5000);
assert(rssAfter - rssBefore < 6_000);
}
// this is for testing that internString data is always on the same address

View File

@ -129,21 +129,18 @@ int main(string[] args)
fs.write("proc_test.d", code);
auto output = executeShell("$DC -verrors=0 -c proc_test.d").output;
auto output = executeShell("$DC -verrors=0 $ERROR_STYLE -c proc_test.d").output;
size_t numErrors = 0;
string[][string] variableIncompatibilities;
// Example of a line we want to match: `proc_test.d:2568:22: error: [...]'
auto errRegex = regex(`proc_test\.d:([0-9]*):[0-9]*: error`, "i");
foreach (err; output.lineSplitter)
{
if (!err.startsWith("proc_test.d("))
continue;
err = err["proc_test.d(".length .. $];
auto lineNo = err.parse!int;
if (!err.startsWith("): Error: "))
continue;
err = err["): Error: ".length .. $];
if (auto m = matchFirst(err, errRegex)) {
auto lineNo = to!int(m[1]);
string line = lines[lineNo - 1];
enforce(line.endsWith("();"), "Unexpected error in line " ~ lineNo.to!string);
line = line[0 .. $ - 3];
@ -153,6 +150,7 @@ int main(string[] args)
variableIncompatibilities[varName] ~= funcName;
numErrors++;
}
}
enforce(numErrors > 1_000, "compiler didn't error as expected, need to adjust tests!");

View File

@ -4,4 +4,21 @@ if [ -z "${DC:-}" ]; then
DC=dmd
fi
DC="$DC" "$DC" -run generate_tests.d "$1"
DCBASE=$(basename "${DC}")
# Set up ERROR_STYLE to make all compilers output errors in the same
# format to make matching easier in generate_tests.d.
if [[ ${DCBASE} =~ gdmd ]]; then
ERROR_STYLE=
elif [[ ${DCBASE} =~ dmd|ldc ]]; then
ERROR_STYLE='-verror-style=gnu -vcolumns'
else
echo "unknonwn compiler ${DC}"
exit 1
fi
export DC ERROR_STYLE
# gdc uses language specific error message
export LC_ALL=${LC_ALL:-"C.UTF-8"}
${DC} -run generate_tests.d "${1}"