From c24f3a5c029e3761cc531f3b93488a11531de2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 9 Feb 2024 10:43:42 +0100 Subject: [PATCH] Test the whole of vibe-d as part of the CI. --- .github/workflows/test.yml | 87 ++++++++++++++++++++++++++------------ test.sh | 43 +++++++++++++++++++ 2 files changed, 102 insertions(+), 28 deletions(-) create mode 100755 test.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb1d83b..8ed7498 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Run all D Tests +name: CI # Only triggers on pushes/PRs to master on: @@ -11,30 +11,61 @@ on: - github_actions jobs: - test: - name: Dub Tests - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - dc: [dmd-latest, ldc-latest] - arch: [x86_64] - include: - - { os: windows-latest, dc: dmd-2.092.0, arch: x86_64 } - - { os: windows-latest, dc: dmd-2.092.0, arch: x86_mscoff } - - { os: windows-latest, dc: dmd-2.091.1, arch: x86_64 } - - { os: windows-latest, dc: ldc-1.20.1, arch: x86_64 } - - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - - name: Install D compiler - uses: dlang-community/setup-dlang@v1 - with: - compiler: ${{ matrix.dc }} - - - name: Run tests - run: dub test -a ${{matrix.arch}} - shell: bash + test: + name: Unittests + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + dc: [dmd-latest, ldc-latest] + arch: [x86_64] + tests: [unittests] + include: + - { os: windows-latest, dc: dmd-2.092.0, arch: x86_64, tests: unittests } + - { os: windows-latest, dc: dmd-2.092.0, arch: x86_mscoff, tests: unittests } + - { os: windows-latest, dc: dmd-2.091.1, arch: x86_64, tests: unittests } + - { os: windows-latest, dc: ldc-1.20.1, arch: x86_64, tests: unittests } + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Install D compiler + uses: dlang-community/setup-dlang@v1 + with: + compiler: ${{ matrix.dc }} + + - name: Run tests + env: + ARCH: ${{matrix.arch}} + TESTS: ${{matrix.tests}} + run: ./test.sh + shell: bash + + vibe-d: + name: vibe.d + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + dc: [dmd-latest, ldc-latest] + arch: [x86_64] + tests: [vibe-d] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Install D compiler + uses: dlang-community/setup-dlang@v1 + with: + compiler: ${{ matrix.dc }} + + - name: Run tests + env: + ARCH: ${{matrix.arch}} + TESTS: ${{matrix.tests}} + run: ./test.sh + shell: bash diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..35a9a04 --- /dev/null +++ b/test.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e -x -o pipefail + +DUB_ARGS="--compiler $DC -a $ARCH" +# default to run all parts +: ${TESTS:=unittests,vibe-d} + +if [[ $TESTS =~ (^|,)unittests(,|$) ]]; then + dub test $DUB_ARGS +fi + +if [[ $TESTS =~ (^|,)vibe-d(,|$) ]]; then + PATH_ESCAPED=$(echo `pwd` | sed 's_/_\\/_g') + SED_EXPR='s/"vibe-container": [^,]*(,?)/"vibe-container": \{"path": "'$PATH_ESCAPED'"\}\1/g' + + git clone https://github.com/vibe-d/vibe-core.git --depth 1 + cd vibe-core + dub upgrade -s + sed -i -E "$SED_EXPR" dub.selections.json + dub test + cd .. + + git clone https://github.com/vibe-d/vibe.d.git --depth 1 + cd vibe.d + dub upgrade -s + for i in `find | grep dub.selections.json`; do + sed -i -E "$SED_EXPR" $i + done + dub test :data $DUB_ARGS + dub test :mongodb $DUB_ARGS + dub test :redis $DUB_ARGS + dub test :web $DUB_ARGS + dub test :utils $DUB_ARGS + dub test :http $DUB_ARGS + dub test :mail $DUB_ARGS + dub test :stream $DUB_ARGS + dub test :crypto $DUB_ARGS + dub test :tls $DUB_ARGS + dub test :textfilter $DUB_ARGS + dub test :inet $DUB_ARGS + cd .. +fi