mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
GHA: Add Windows jobs to main workflow
This commit is contained in:
parent
d03a4d43af
commit
b4aea9f670
2 changed files with 56 additions and 9 deletions
47
.github/workflows/main.yml
vendored
47
.github/workflows/main.yml
vendored
|
@ -10,7 +10,7 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
posix:
|
main:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -61,12 +61,20 @@ jobs:
|
||||||
# de-facto bootstrap version on OSX
|
# de-facto bootstrap version on OSX
|
||||||
# See: https://github.com/dlang/dmd/pull/13890
|
# See: https://github.com/dlang/dmd/pull/13890
|
||||||
host_dmd: dmd-2.099.1
|
host_dmd: dmd-2.099.1
|
||||||
|
# Windows
|
||||||
|
- job_name: Windows x64, LDC
|
||||||
|
os: windows-2022
|
||||||
|
host_dmd: ldc-latest
|
||||||
|
- job_name: Windows x86, LDC
|
||||||
|
os: windows-2022
|
||||||
|
host_dmd: ldc-latest
|
||||||
|
model: 32
|
||||||
name: ${{ matrix.job_name }}
|
name: ${{ matrix.job_name }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
timeout-minutes: 40
|
timeout-minutes: 40
|
||||||
env:
|
env:
|
||||||
# for ci/run.sh:
|
# for ci/run.sh:
|
||||||
OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'osx' || '') }}
|
OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'osx' || (startsWith(matrix.os, 'windows') && 'windows' || '')) }}
|
||||||
MODEL: ${{ matrix.model || '64' }}
|
MODEL: ${{ matrix.model || '64' }}
|
||||||
HOST_DMD: ${{ matrix.host_dmd }}
|
HOST_DMD: ${{ matrix.host_dmd }}
|
||||||
N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }}
|
N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }}
|
||||||
|
@ -75,14 +83,32 @@ jobs:
|
||||||
DMD_TEST_COVERAGE: ${{ matrix.coverage && '1' || '0' }}
|
DMD_TEST_COVERAGE: ${{ matrix.coverage && '1' || '0' }}
|
||||||
# work around https://issues.dlang.org/show_bug.cgi?id=23517
|
# work around https://issues.dlang.org/show_bug.cgi?id=23517
|
||||||
MACOSX_DEPLOYMENT_TARGET: '11'
|
MACOSX_DEPLOYMENT_TARGET: '11'
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 50
|
fetch-depth: 50
|
||||||
- name: Install prerequisites
|
|
||||||
|
- name: 'Posix: Install prerequisites'
|
||||||
|
if: runner.os != 'Windows'
|
||||||
run: ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }}
|
run: ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }}
|
||||||
- name: Install host compiler
|
- name: 'Windows: Set up MSVC environment'
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
uses: seanmiddleditch/gha-setup-vsdevenv@v4
|
||||||
|
with:
|
||||||
|
arch: ${{ env.MODEL == '64' && 'x64' || 'x86' }}
|
||||||
|
|
||||||
|
- name: 'Posix: Install host compiler'
|
||||||
|
if: runner.os != 'Windows'
|
||||||
run: ci/run.sh install_host_compiler
|
run: ci/run.sh install_host_compiler
|
||||||
|
- name: 'Windows: Install host compiler'
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
uses: dlang-community/setup-dlang@v1.3.0
|
||||||
|
with:
|
||||||
|
compiler: ${{ matrix.host_dmd }}
|
||||||
|
|
||||||
- name: Set up repos
|
- name: Set up repos
|
||||||
run: |
|
run: |
|
||||||
set -uexo pipefail
|
set -uexo pipefail
|
||||||
|
@ -104,6 +130,12 @@ jobs:
|
||||||
ci/run.sh setup_repos "$REPO_BRANCH"
|
ci/run.sh setup_repos "$REPO_BRANCH"
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ${{ matrix.disable_debug_for_dmd_unittests && 'ENABLE_DEBUG=0' || '' }} ci/run.sh build
|
run: ${{ matrix.disable_debug_for_dmd_unittests && 'ENABLE_DEBUG=0' || '' }} ci/run.sh build
|
||||||
|
env:
|
||||||
|
# on Windows, `ci/run.sh build` expects the DMD env var to be set to the DMD-CLI-compatible host compiler
|
||||||
|
DMD: ${{ runner.os == 'Windows' && (startsWith(matrix.host_dmd, 'ldc') && 'ldmd2' || 'dmd') || '' }}
|
||||||
|
# work around the LDC host compiler on Windows assuming the first link.exe in PATH is the MSVC one
|
||||||
|
# (VSINSTALLDIR is set, but GHA uses Git's bin\bash.exe for `shell: bash`, which prepends Git's usr\bin to PATH, with GNU link.exe)
|
||||||
|
LDC_VSDIR_FORCE: ${{ runner.os == 'Windows' && startsWith(matrix.host_dmd, 'ldc') && '1' || '' }}
|
||||||
- name: Rebuild dmd (with enabled coverage)
|
- name: Rebuild dmd (with enabled coverage)
|
||||||
if: matrix.coverage
|
if: matrix.coverage
|
||||||
run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ci/run.sh rebuild
|
run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ci/run.sh rebuild
|
||||||
|
@ -112,6 +144,13 @@ jobs:
|
||||||
- name: Test druntime
|
- name: Test druntime
|
||||||
if: '!matrix.coverage'
|
if: '!matrix.coverage'
|
||||||
run: ci/run.sh test_druntime
|
run: ci/run.sh test_druntime
|
||||||
|
- name: 'Windows x86: Add 32-bit libcurl.dll to PATH (required for Phobos unittests)'
|
||||||
|
if: runner.os == 'Windows' && env.MODEL == '32' && !matrix.coverage
|
||||||
|
run: |
|
||||||
|
# LDC
|
||||||
|
echo "$(dirname "$(which $DC)")/../lib32" >> $GITHUB_PATH
|
||||||
|
# DMD
|
||||||
|
echo "$(dirname "$(which $DC)")/../bin" >> $GITHUB_PATH
|
||||||
- name: Test phobos
|
- name: Test phobos
|
||||||
if: '!matrix.coverage'
|
if: '!matrix.coverage'
|
||||||
run: ci/run.sh test_phobos
|
run: ci/run.sh test_phobos
|
||||||
|
|
10
ci/run.sh
10
ci/run.sh
|
@ -7,7 +7,7 @@ set -uexo pipefail
|
||||||
|
|
||||||
# N: number of parallel build jobs
|
# N: number of parallel build jobs
|
||||||
if [ -z ${N+x} ] ; then echo "Variable 'N' needs to be set."; exit 1; fi
|
if [ -z ${N+x} ] ; then echo "Variable 'N' needs to be set."; exit 1; fi
|
||||||
# OS_NAME: linux|osx|freebsd
|
# OS_NAME: linux|osx|freebsd|windows
|
||||||
if [ -z ${OS_NAME+x} ] ; then echo "Variable 'OS_NAME' needs to be set."; exit 1; fi
|
if [ -z ${OS_NAME+x} ] ; then echo "Variable 'OS_NAME' needs to be set."; exit 1; fi
|
||||||
# FULL_BUILD: true|false (true on Linux: use full permutations for DMD tests)
|
# FULL_BUILD: true|false (true on Linux: use full permutations for DMD tests)
|
||||||
if [ -z ${FULL_BUILD+x} ] ; then echo "Variable 'FULL_BUILD' needs to be set."; exit 1; fi
|
if [ -z ${FULL_BUILD+x} ] ; then echo "Variable 'FULL_BUILD' needs to be set."; exit 1; fi
|
||||||
|
@ -58,13 +58,17 @@ clone() {
|
||||||
|
|
||||||
# build dmd (incl. building and running the unittests), druntime, phobos
|
# build dmd (incl. building and running the unittests), druntime, phobos
|
||||||
build() {
|
build() {
|
||||||
|
if [ "$OS_NAME" != "windows" ]; then
|
||||||
source ~/dlang/*/activate # activate host compiler, incl. setting `DMD`
|
source ~/dlang/*/activate # activate host compiler, incl. setting `DMD`
|
||||||
|
fi
|
||||||
$DMD compiler/src/build.d -ofgenerated/build
|
$DMD compiler/src/build.d -ofgenerated/build
|
||||||
generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" BUILD=debug unittest
|
generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" BUILD=debug unittest
|
||||||
generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=1 dmd
|
generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=1 dmd
|
||||||
make -j$N -C druntime MODEL=$MODEL
|
make -j$N -C druntime MODEL=$MODEL
|
||||||
make -j$N -C ../phobos MODEL=$MODEL
|
make -j$N -C ../phobos MODEL=$MODEL
|
||||||
|
if [ "$OS_NAME" != "windows" ]; then
|
||||||
deactivate # deactivate host compiler
|
deactivate # deactivate host compiler
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# self-compile dmd
|
# self-compile dmd
|
||||||
|
@ -124,7 +128,9 @@ test_phobos() {
|
||||||
|
|
||||||
# test dub package
|
# test dub package
|
||||||
test_dub_package() {
|
test_dub_package() {
|
||||||
|
if [ "$OS_NAME" != "windows" ]; then
|
||||||
source ~/dlang/*/activate # activate host compiler
|
source ~/dlang/*/activate # activate host compiler
|
||||||
|
fi
|
||||||
# GDC's standard library is too old for some example scripts
|
# GDC's standard library is too old for some example scripts
|
||||||
if [[ "${DMD:-dmd}" =~ "gdmd" ]] ; then
|
if [[ "${DMD:-dmd}" =~ "gdmd" ]] ; then
|
||||||
echo "Skipping DUB examples on GDC."
|
echo "Skipping DUB examples on GDC."
|
||||||
|
@ -146,7 +152,9 @@ test_dub_package() {
|
||||||
# Test rdmd build
|
# Test rdmd build
|
||||||
"${build_path}/dmd" -version=NoBackend -version=GC -version=NoMain -Jgenerated/dub -Jsrc/dmd/res -Isrc -i -run test/dub_package/frontend.d
|
"${build_path}/dmd" -version=NoBackend -version=GC -version=NoMain -Jgenerated/dub -Jsrc/dmd/res -Isrc -i -run test/dub_package/frontend.d
|
||||||
fi
|
fi
|
||||||
|
if [ "$OS_NAME" != "windows" ]; then
|
||||||
deactivate
|
deactivate
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# clone phobos repos if not already available
|
# clone phobos repos if not already available
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue