# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: D

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - uses: dlang-community/setup-dlang@4c99aa991ce7d19dd3064de0a4f2f6b2f152e2d7

    - name: 'Build & Test'
      run: |
        # Build the project, with its main file included, without unittests
        dub build --compiler=$DC
        # Build and run tests, as defined by `unittest` configuration
        # In this mode, `mainSourceFile` is excluded and `version (unittest)` are included
        # See https://dub.pm/package-format-json.html#configurations
        dub test --compiler=$DC
