Skip to content

Bump setup-dlang to v2 #243

Bump setup-dlang to v2

Bump setup-dlang to v2 #243

Workflow file for this run

name: run-tests
on:
pull_request:
push:
branches:
- master
defaults:
run:
shell: bash
jobs:
main:
name: Run all tests
# Only run for the main repository - not forks
if: ${{ github.repository == 'dlang-community/D-Scanner' }}
# Run permutations of common os + host compilers
strategy:
fail-fast: false
matrix:
compiler: [
dmd-latest,
ldc-latest,
gdc-12,
]
host: [
ubuntu-22.04,
macos-latest,
windows-latest,
]
build: [
{ type: make },
{ type: dub, version: 'current' },
{ type: dub, version: 'min libdparse' },
# Fail due to unresolvable dependencies
# { type: dub, version: 'max libdparse' },
# { type: dub, version: 'min dsymbol' },
# { type: dub, version: 'max dsymbol' },
]
exclude:
# Restrict GDC to Ubuntu
- compiler: gdc-12
host: windows-latest
- compiler: gdc-12
host: macos-latest
include:
- { do_report: 1, build: { type: dub, version: 'current' }, host: 'ubuntu-22.04', compiler: dmd-latest }
runs-on: ${{ matrix.host }}
steps:
# Clone repo + submodules
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Install Dlang tools (for gdc)
if: ${{ startsWith(matrix.compiler, 'gdc') }}
uses: dlang-community/setup-dlang@v2
# Install the host compiler
- name: Install ${{ matrix.compiler }}
uses: dlang-community/setup-dlang@v2
with:
compiler: ${{ matrix.compiler }}
- name: Setup DFLAGS for gdc
if: ${{ startsWith(matrix.compiler, 'gdc') }}
# Need to pass -allinst otherwise the build fails
# We can't simply use `DFLAGS=-allinst dub` since that
# disables unittests.
run: |
cat <<EOF | sudo tee -a /etc/dmd.conf
[Environment]
DFLAGS=-allinst -q,-Wno-error
EOF
# Compile D-Scanner and execute all tests without dub
- name: Build and test without dub
if: ${{ matrix.build.type == 'make' }}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export MFLAGS="-m64"
./build.bat
./build.bat test
else
make "-j$(nproc)" all test
fi
# Compile D-Scanner and execute all tests using a specific dependency version
# Currently skipped for GDC (dub installed from apt-get is broken)
- name: Build and test with dub (min or max libdparse test)
if: ${{ matrix.build.type == 'dub' && matrix.build.version != 'current' }}
env:
DC: ${{ env.DMD }}
run: |
rdmd ./d-test-utils/test_with_package.d ${{ matrix.build.version }} -- dub build
rdmd ./d-test-utils/test_with_package.d ${{ matrix.build.version }} -- dub test
- name: Build and test with dub (with dub.selections.json)
if: ${{ matrix.build.type == 'dub' && matrix.build.version == 'current' }}
env:
DC: ${{ env.DMD }}
run: |
dub build
dub test
- uses: actions/upload-artifact@v4
with:
name: bin-${{matrix.build.type}}-${{matrix.build.version}}-${{ matrix.compiler }}-${{ matrix.host }}
path: bin
# Lint source code using the previously built binary
- name: Run linter
env:
REPORT_GITHUB: ${{matrix.do_report}}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
EXE=".exe"
else
EXE=""
fi
if [ "$REPORT_GITHUB" == "1" ]; then
FORMAT="github"
else
FORMAT=""
fi
"./bin/dscanner$EXE" --styleCheck -f "$FORMAT" src
- name: Integration Tests
run: ./it.sh
working-directory: tests
# Parse phobos to check for failures / crashes / ...
- name: Checkout Phobos
uses: actions/checkout@v4
with:
repository: dlang/phobos
path: phobos
- name: Apply D-Scanner to Phobos
if: ${{ matrix.build.version != 'min libdparse'}} # Older versions crash with "Invalid UTF..."
working-directory: phobos
run: |
for FILE in $(find std -name '*.d');
do
echo "$FILE"
../bin/dscanner -S --config=.dscanner.ini "$FILE"
done