Use ldc-1.31.0 #306
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: CI | |
on: | |
push: # test + build + release | |
branches: [ master ] | |
pull_request: # test + build | |
branches: [ master ] | |
release: # test + build + release | |
types: [ published ] | |
env: | |
DC: ldc-1.31.0 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
name: Test | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ${{ env.DC }} | |
- name: Test | |
run: | | |
cd source | |
ldc2 -m64 -g -i main.d -unittest -of=test.exe | |
./test.exe | |
build: | |
name: Build CLI | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
EXE: vox | |
PLATFORM: linux-x64 | |
- os: macos-latest | |
EXE: vox | |
PLATFORM: macos-x64 | |
- os: windows-latest | |
EXE: vox.exe | |
PLATFORM: windows-x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ${{ env.DC }} | |
- name: Build release | |
run: | | |
mkdir -p bin | |
cd source | |
ldc2 -d-version=test -m64 -release -fprofile-instr-generate -i main.d -of=vox_instrumented.exe | |
./vox_instrumented.exe | |
ldc-profdata merge default.profraw -output vox.profdata | |
ldc2 -m64 -O3 -mcpu=x86-64-v3 -release -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -d-version=cli -fprofile-instr-use=vox.profdata -of=../bin/${{matrix.EXE}} -i main.d | |
cd ../bin | |
7z a -mx9 vox-${{matrix.PLATFORM}}.zip ${{matrix.EXE}} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./bin/vox-${{matrix.PLATFORM}}.zip | |
build-debug: | |
name: Build CLI debug | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
EXE: vox | |
PLATFORM: linux-x64 | |
- os: macos-latest | |
EXE: vox | |
PLATFORM: macos-x64 | |
- os: windows-latest | |
EXE: vox.exe | |
DBG_FILE: vox.pdb | |
PLATFORM: windows-x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ${{ env.DC }} | |
- name: Build release | |
run: | | |
mkdir -p bin | |
cd source | |
ldc2 -d-version=test -m64 -release -fprofile-instr-generate -i main.d -of=vox_instrumented.exe | |
./vox_instrumented.exe | |
ldc-profdata merge default.profraw -output vox.profdata | |
ldc2 -m64 -O3 -mcpu=x86-64-v3 --d-debug -g -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -d-version=cli -fprofile-instr-use=vox.profdata -of=../bin/${{matrix.EXE}} -i main.d | |
cd ../bin | |
7z a -mx9 vox-${{matrix.PLATFORM}}-dbg.zip ${{matrix.EXE}} ${{matrix.DBG_FILE}} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./bin/vox-${{matrix.PLATFORM}}-dbg.zip | |
build-shared: | |
name: Build shared | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
DLL: libvox.so | |
PLATFORM: linux-x64 | |
- os: macos-latest | |
DLL: libvox.dylib | |
PLATFORM: macos-x64 | |
- os: windows-latest | |
DLL: libvox.dll | |
LIB: libvox.lib | |
PLATFORM: windows-x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ${{ env.DC }} | |
- name: Build shared lib | |
run: | | |
mkdir -p bin | |
cd source | |
ldc2 -m64 -shared -O3 -mcpu=x86-64-v3 -release -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -fvisibility=hidden -link-defaultlib-shared=false -i c_api.d -of=../bin/${{matrix.DLL}} | |
cd ../bin | |
7z a -mx9 libvox-${{matrix.PLATFORM}}.zip ${{matrix.DLL}} ${{matrix.LIB}} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./bin/libvox-${{matrix.PLATFORM}}.zip | |
build-shared-debug: | |
name: Build shared debug | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
DLL: libvox.so | |
PLATFORM: linux-x64 | |
- os: macos-latest | |
DLL: libvox.dylib | |
PLATFORM: macos-x64 | |
- os: windows-latest | |
DLL: libvox.dll | |
LIB: libvox.lib | |
DBG_FILE: libvox.pdb | |
PLATFORM: windows-x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ${{ env.DC }} | |
- name: Build shared lib | |
run: | | |
mkdir -p bin | |
cd source | |
ldc2 -m64 -shared -O3 -mcpu=x86-64-v3 --d-debug -g -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -fvisibility=hidden -link-defaultlib-shared=false -i c_api.d -of=../bin/${{matrix.DLL}} | |
cd ../bin | |
7z a -mx9 libvox-${{matrix.PLATFORM}}-dbg.zip ${{matrix.DLL}} ${{matrix.LIB}} ${{matrix.DBG_FILE}} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./bin/libvox-${{matrix.PLATFORM}}-dbg.zip | |
upload: | |
name: Upload build | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
needs: [test, build, build-debug, build-shared, build-shared-debug] | |
steps: | |
# Cloning is needed for `gh release create` to work. It looks repository up in .git folder | |
- uses: actions/checkout@v3 | |
# Download build artifacts of other jobs | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: bin/ | |
# Update tag, so that we get proper date and commit on github | |
- name: Update CI tag | |
uses: richardsimko/update-tag@v1 | |
if: github.ref == 'refs/heads/master' | |
with: | |
tag_name: CI | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Create CI release and upload builds | |
- name: Upload | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
tag=`basename ${{ github.ref }}` | |
if [ $tag = 'master' ]; then | |
tag='CI' | |
fi | |
# --clobber Overwrite existing assets of the same name | |
gh release upload $tag bin/*.zip --clobber |