Update d.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SurrealDB.D CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [ created ] | |
jobs: | |
test: | |
name: Test on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# Ubuntu with both DMD and LDC | |
- os: ubuntu-latest | |
dc: dmd-latest | |
- os: ubuntu-latest | |
dc: ldc-latest | |
# Windows with both DMD and LDC | |
- os: windows-latest | |
dc: dmd-latest | |
- os: windows-latest | |
dc: ldc-latest | |
# macOS with LDC only (as DMD doesn't support ARM) | |
- os: macos-14 | |
dc: ldc-latest | |
- os: macos-latest | |
dc: ldc-latest | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Install D compiler | |
uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ${{ matrix.dc }} | |
if: ${{ !startsWith(matrix.os, 'macos-14') || matrix.dc != 'dmd-latest' }} | |
- name: Install D compiler on macOS ARM | |
if: startsWith(matrix.os, 'macos-14') | |
run: | | |
brew install ldc | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: aarch64-apple-darwin,x86_64-apple-darwin | |
- name: Build | |
run: | | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
export PATH="/opt/homebrew/opt/ldc/bin:$PATH" | |
fi | |
dub build --compiler=ldc2 | |
shell: bash | |
- name: Run Tests | |
run: | | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
export PATH="/opt/homebrew/opt/ldc/bin:$PATH" | |
fi | |
dub test --compiler=ldc2 | |
shell: bash | |
- name: Run Example | |
run: | | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
export PATH="/opt/homebrew/opt/ldc/bin:$PATH" | |
fi | |
dub run -c example --compiler=ldc2 | |
shell: bash | |
docs: | |
name: Generate Documentation | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install D compiler | |
uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ldc-latest | |
- name: Generate Documentation | |
run: | | |
dub build -b ddox | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
release: | |
name: Create Release Build | |
needs: test | |
runs-on: ${{ matrix.os }} | |
if: github.event_name == 'release' | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
artifact_name: surrealdb-d-linux | |
- os: windows-latest | |
artifact_name: surrealdb-d-windows | |
- os: macos-14 | |
artifact_name: surrealdb-d-macos-arm | |
- os: macos-latest | |
artifact_name: surrealdb-d-macos-intel | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Install D compiler | |
uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ldc-latest | |
if: ${{ !startsWith(matrix.os, 'macos-14') }} | |
- name: Install D compiler on macOS ARM | |
if: startsWith(matrix.os, 'macos-14') | |
run: | | |
brew install ldc | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: aarch64-apple-darwin,x86_64-apple-darwin | |
- name: Build Release | |
run: | | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
export PATH="/opt/homebrew/opt/ldc/bin:$PATH" | |
fi | |
dub build -b release --compiler=ldc2 | |
shell: bash | |
- name: Package Artifacts | |
shell: bash | |
run: | | |
mkdir -p artifacts | |
cp -r README.md LICENSE source/app.d artifacts/ | |
cp -r source/bindings artifacts/ | |
cd artifacts | |
zip -r "../${{ matrix.artifact_name }}.zip" . | |
- name: Upload Release Artifacts | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./${{ matrix.artifact_name }}.zip | |
asset_name: ${{ matrix.artifact_name }}.zip | |
asset_content_type: application/zip |