add DString.insert_at (#1026) #4087
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: | |
branches: [ master, dev, ci_testing ] | |
pull_request: | |
branches: [ master ] | |
env: | |
LLVM_RELEASE_VERSION: 16 | |
jobs: | |
build-msvc: | |
runs-on: windows-latest | |
strategy: | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
matrix: | |
build_type: [ Release, Debug ] | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- uses: actions/checkout@v4 | |
- name: CMake | |
run: | | |
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
cmake --build build --config ${{ matrix.build_type }} | |
- name: Compile and run some examples | |
run: | | |
cd resources | |
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\hello_world_many.c3 | |
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\time.c3 | |
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\fannkuch-redux.c3 | |
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\contextfree\boolerr.c3 | |
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\ls.c3 | |
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\load_world.c3 | |
..\build\${{ matrix.build_type }}\c3c.exe compile-run examples\process.c3 | |
..\build\${{ matrix.build_type }}\c3c.exe compile --test -g -O0 --threads 1 --target macos-x64 examples\constants.c3 | |
- name: Build testproject | |
run: | | |
cd resources/testproject | |
..\..\build\${{ matrix.build_type }}\c3c.exe --debug-log run hello_world_win32 | |
- name: Build testproject lib | |
run: | | |
cd resources/testproject | |
..\..\build\${{ matrix.build_type }}\c3c.exe --debug-log build hello_world_win32_lib | |
- name: Vendor-fetch | |
run: | | |
build\${{ matrix.build_type }}\c3c.exe vendor-fetch raylib | |
- name: run compiler tests | |
run: | | |
cd test | |
python3.exe src/tester.py ..\build\${{ matrix.build_type }}\c3c.exe test_suite/ | |
- name: Compile run unit tests | |
run: | | |
cd test | |
..\build\${{ matrix.build_type }}\c3c.exe compile-test unit -O1 | |
- name: upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: c3-windows-${{ matrix.build_type }} | |
path: build\${{ matrix.build_type }}\c3c.exe | |
build-msys2-mingw: | |
runs-on: windows-latest | |
strategy: | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
matrix: | |
build_type: [Release, Debug] | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
install: git binutils mingw-w64-x86_64-clang mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-python | |
- shell: msys2 {0} | |
run: | | |
pacman --noconfirm -U https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-llvm-17.0.1-1-any.pkg.tar.zst | |
pacman --noconfirm -U https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-lld-17.0.1-1-any.pkg.tar.zst | |
- name: CMake | |
run: | | |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
cmake --build build | |
- name: Compile and run some examples | |
run: | | |
cd resources | |
../build/c3c compile-run examples/hello_world_many.c3 | |
../build/c3c compile-run examples/time.c3 | |
../build/c3c compile-run examples/fannkuch-redux.c3 | |
../build/c3c compile-run examples/contextfree/boolerr.c3 | |
../build/c3c compile-run examples/load_world.c3 | |
../build/c3c compile --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3 | |
- name: Build testproject | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log | |
- name: Vendor-fetch | |
run: | | |
./build/c3c vendor-fetch raylib | |
- name: Build testproject lib | |
run: | | |
cd resources/testproject | |
../../build/c3c build hello_world_lib --debug-log | |
- name: run compiler tests | |
run: | | |
cd test | |
python3 src/tester.py ../build/c3c.exe test_suite/ | |
build-msys2-clang: | |
runs-on: windows-latest | |
#if: ${{ false }} | |
strategy: | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
matrix: | |
build_type: [Release, Debug] | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: CLANG64 | |
update: false | |
install: git binutils mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-python | |
- name: CMake | |
run: | | |
cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
cmake --build build | |
- name: Compile and run some examples | |
run: | | |
cd resources | |
../build/c3c compile-run examples/hello_world_many.c3 | |
../build/c3c compile-run examples/time.c3 | |
../build/c3c compile-run examples/fannkuch-redux.c3 | |
../build/c3c compile-run examples/contextfree/boolerr.c3 | |
../build/c3c compile-run examples/load_world.c3 | |
../build/c3c compile --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3 | |
- name: Build testproject | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log | |
- name: Build testproject lib | |
run: | | |
cd resources/testproject | |
../../build/c3c build hello_world_lib --debug-log | |
- name: run compiler tests | |
run: | | |
cd test | |
python3 src/tester.py ../build/c3c.exe test_suite/ | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
matrix: | |
build_type: [Release, Debug] | |
llvm_version: [15, 16, 17, 18] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install common deps | |
run: | | |
sudo apt-get install zlib1g zlib1g-dev python3 ninja-build curl | |
- name: Install Clang ${{matrix.llvm_version}} | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
if [[ "${{matrix.llvm_version}}" < 16 ]]; then | |
sudo apt remove libllvm15 | |
fi | |
if [[ "${{matrix.llvm_version}}" < 18 ]]; then | |
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${{matrix.llvm_version}} main" | |
sudo apt-get update | |
sudo apt-get install -y -t llvm-toolchain-focal-${{matrix.llvm_version}} libpolly-${{matrix.llvm_version}}-dev \ | |
clang-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}}-dev \ | |
lld-${{matrix.llvm_version}} liblld-${{matrix.llvm_version}}-dev libmlir-${{matrix.llvm_version}} \ | |
libmlir-${{matrix.llvm_version}}-dev mlir-${{matrix.llvm_version}}-tools | |
else | |
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" | |
sudo apt-get install -y -t llvm-toolchain-focal libpolly-${{matrix.llvm_version}}-dev \ | |
clang-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}}-dev \ | |
lld-${{matrix.llvm_version}} liblld-${{matrix.llvm_version}}-dev libmlir-${{matrix.llvm_version}} \ | |
libmlir-${{matrix.llvm_version}}-dev mlir-${{matrix.llvm_version}}-tools | |
fi | |
- name: CMake | |
run: | | |
cmake -B build \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER=clang-${{matrix.llvm_version}} \ | |
-DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm_version}} \ | |
-DCMAKE_LINKER=lld-link-${{matrix.llvm_version}} \ | |
-DCMAKE_OBJCOPY=llvm-objcopy-${{matrix.llvm_version}} \ | |
-DCMAKE_STRIP=llvm-strip-${{matrix.llvm_version}} \ | |
-DCMAKE_DLLTOOL=llvm-dlltool-${{matrix.llvm_version}} \ | |
-DC3_LLVM_VERSION=${{matrix.llvm_version}} | |
cmake --build build | |
- name: Compile and run some examples | |
run: | | |
cd resources | |
../build/c3c compile examples/base64.c3 | |
../build/c3c compile examples/binarydigits.c3 | |
../build/c3c compile examples/brainfk.c3 | |
../build/c3c compile examples/factorial_macro.c3 | |
../build/c3c compile examples/fasta.c3 | |
../build/c3c compile examples/gameoflife.c3 | |
../build/c3c compile examples/hash.c3 | |
../build/c3c compile examples/levenshtein.c3 | |
../build/c3c compile examples/load_world.c3 | |
../build/c3c compile examples/map.c3 | |
../build/c3c compile examples/mandelbrot.c3 | |
../build/c3c compile examples/plus_minus.c3 | |
../build/c3c compile examples/nbodies.c3 | |
../build/c3c compile examples/spectralnorm.c3 | |
../build/c3c compile examples/swap.c3 | |
../build/c3c compile examples/contextfree/boolerr.c3 | |
../build/c3c compile examples/contextfree/dynscope.c3 | |
../build/c3c compile examples/contextfree/guess_number.c3 | |
../build/c3c compile examples/contextfree/multi.c3 | |
../build/c3c compile examples/contextfree/cleanup.c3 | |
../build/c3c compile-run examples/hello_world_many.c3 | |
../build/c3c compile-run examples/time.c3 | |
../build/c3c compile-run examples/fannkuch-redux.c3 | |
../build/c3c compile-run examples/contextfree/boolerr.c3 | |
../build/c3c compile-run examples/load_world.c3 | |
../build/c3c compile-run examples/process.c3 | |
../build/c3c compile-run examples/ls.c3 | |
- name: Compile run unit tests | |
run: | | |
cd test | |
../build/c3c compile-test unit | |
- name: Build testproject | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log | |
- name: Build testproject direct linker | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log --system-linker=no | |
- name: run compiler tests | |
run: | | |
cd test | |
python3 src/tester.py ../build/c3c test_suite/ | |
- name: bundle_output | |
if: matrix.llvm_version == 16 | |
run: | | |
mkdir linux | |
cp -r lib linux | |
cp msvc_build_libraries.py linux | |
cp build/c3c linux | |
tar czf c3-linux-${{matrix.build_type}}.tar.gz linux | |
- name: upload artifacts | |
if: matrix.llvm_version == 16 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: c3-linux-${{matrix.build_type}} | |
path: c3-linux-${{matrix.build_type}}.tar.gz | |
build-linux-ubuntu20: | |
runs-on: ubuntu-20.04 | |
strategy: | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
matrix: | |
build_type: [Release, Debug] | |
llvm_version: [16] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install common deps | |
run: | | |
sudo apt-get install zlib1g zlib1g-dev python3 ninja-build curl | |
- name: Install Clang ${{matrix.llvm_version}} | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
if [[ "${{matrix.llvm_version}}" < 17 ]]; then | |
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${{matrix.llvm_version}} main" | |
else | |
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" | |
fi | |
sudo apt-get update | |
sudo apt-get install -y clang-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}}-dev lld-${{matrix.llvm_version}} liblld-${{matrix.llvm_version}}-dev | |
sudo apt-get install -y libmlir-${{matrix.llvm_version}} libmlir-${{matrix.llvm_version}}-dev mlir-${{matrix.llvm_version}}-tools | |
sudo apt-get install -y libpolly-${{matrix.llvm_version}}-dev | |
- name: CMake | |
run: | | |
cmake -B build \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER=clang-${{matrix.llvm_version}} \ | |
-DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm_version}} \ | |
-DCMAKE_LINKER=lld-link-${{matrix.llvm_version}} \ | |
-DCMAKE_OBJCOPY=llvm-objcopy-${{matrix.llvm_version}} \ | |
-DCMAKE_STRIP=llvm-strip-${{matrix.llvm_version}} \ | |
-DCMAKE_DLLTOOL=llvm-dlltool-${{matrix.llvm_version}} \ | |
-DC3_LLVM_VERSION=${{matrix.llvm_version}} | |
cmake --build build | |
- name: Compile and run some examples | |
run: | | |
cd resources | |
../build/c3c compile examples/gameoflife.c3 | |
../build/c3c compile examples/levenshtein.c3 | |
../build/c3c compile examples/map.c3 | |
../build/c3c compile examples/mandelbrot.c3 | |
../build/c3c compile examples/plus_minus.c3 | |
../build/c3c compile examples/spectralnorm.c3 | |
../build/c3c compile examples/swap.c3 | |
../build/c3c compile examples/contextfree/guess_number.c3 | |
../build/c3c compile-run examples/hash.c3 | |
../build/c3c compile-run examples/nbodies.c3 | |
../build/c3c compile-run examples/contextfree/boolerr.c3 | |
../build/c3c compile-run examples/contextfree/dynscope.c3 | |
../build/c3c compile-run examples/contextfree/multi.c3 | |
../build/c3c compile-run examples/contextfree/cleanup.c3 | |
../build/c3c compile-run examples/hello_world_many.c3 | |
../build/c3c compile-run examples/time.c3 | |
../build/c3c compile-run examples/fannkuch-redux.c3 | |
../build/c3c compile-run examples/load_world.c3 | |
../build/c3c compile-run examples/base64.c3 | |
../build/c3c compile-run examples/binarydigits.c3 | |
../build/c3c compile-run examples/brainfk.c3 | |
../build/c3c compile-run examples/factorial_macro.c3 | |
../build/c3c compile-run examples/fasta.c3 | |
../build/c3c compile-run examples/process.c3 | |
- name: Compile run unit tests | |
run: | | |
cd test | |
../build/c3c compile-test unit | |
- name: Build testproject | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log | |
- name: Build testproject direct linker | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log --system-linker=no | |
- name: run compiler tests | |
run: | | |
cd test | |
python3 src/tester.py ../build/c3c test_suite/ | |
- name: bundle_output | |
if: matrix.llvm_version == 16 | |
run: | | |
mkdir linux | |
cp -r lib linux | |
cp msvc_build_libraries.py linux | |
cp build/c3c linux | |
tar czf c3-ubuntu-20-${{matrix.build_type}}.tar.gz linux | |
- name: upload artifacts | |
if: matrix.llvm_version == 16 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: c3-ubuntu-20-${{matrix.build_type}} | |
path: c3-ubuntu-20-${{matrix.build_type}}.tar.gz | |
build-mac: | |
runs-on: macos-latest | |
strategy: | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
matrix: | |
build_type: [Release, Debug] | |
llvm_version: [15, 16] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download LLVM | |
run: | | |
brew install llvm@${{ matrix.llvm_version }} ninja curl | |
echo "/usr/local/opt/llvm@${{ matrix.llvm_version }}/bin" >> $GITHUB_PATH | |
TMP_PATH=$(xcrun --show-sdk-path)/user/include | |
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV | |
- name: CMake | |
run: | | |
cmake -B build -G Ninja -DC3_LLVM_VERSION=${{matrix.llvm_version}} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
cmake --build build | |
- name: Vendor-fetch | |
run: | | |
./build/c3c vendor-fetch raylib | |
- name: Compile and run some examples | |
run: | | |
cd resources | |
../build/c3c compile-run examples/hello_world_many.c3 | |
../build/c3c compile-run examples/time.c3 | |
../build/c3c compile-run examples/fannkuch-redux.c3 | |
../build/c3c compile-run examples/contextfree/boolerr.c3 | |
../build/c3c compile-run examples/process.c3 | |
../build/c3c compile-run examples/load_world.c3 | |
- name: Compile run unit tests | |
run: | | |
cd test | |
../build/c3c compile-test unit | |
- name: Build testproject | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log | |
- name: Build testproject direct linker | |
run: | | |
cd resources/testproject | |
../../build/c3c run --debug-log --system-linker=no | |
- name: Build testproject lib | |
run: | | |
cd resources/testproject | |
../../build/c3c build hello_world_lib --debug-log | |
- name: run compiler tests | |
run: | | |
cd test | |
python3 src/tester.py ../build/c3c test_suite/ | |
- name: bundle_output | |
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION | |
run: | | |
mkdir macos | |
cp -r lib macos | |
cp msvc_build_libraries.py macos | |
cp build/c3c macos | |
zip -r c3-macos-${{matrix.build_type}}.zip macos | |
- name: upload artifacts | |
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION | |
uses: actions/upload-artifact@v3 | |
with: | |
name: c3-macos-${{matrix.build_type}} | |
path: c3-macos-${{matrix.build_type}}.zip | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-msvc, build-linux, build-mac] | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: delete tag | |
continue-on-error: true | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'tags/latest', | |
sha: context.sha | |
}) | |
- name: create tag | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/latest', | |
sha: context.sha | |
}) | |
- uses: actions/download-artifact@v3 | |
- run: cp -r lib c3-windows-Release | |
- run: cp -r lib c3-windows-Debug | |
- run: cp msvc_build_libraries.py c3-windows-Release | |
- run: cp msvc_build_libraries.py c3-windows-Debug | |
- run: cp install_win_reqs.bat c3-windows-Release | |
- run: cp install_win_reqs.bat c3-windows-Debug | |
- run: zip -r c3-windows-Release.zip c3-windows-Release | |
- run: zip -r c3-windows-Debug.zip c3-windows-Debug | |
- id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: latest | |
release_name: latest | |
draft: false | |
prerelease: true | |
- name: upload windows | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-windows-Release.zip | |
asset_name: c3-windows.zip | |
asset_content_type: application/zip | |
- name: upload windows debug | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-windows-Debug.zip | |
asset_name: c3-windows-debug.zip | |
asset_content_type: application/zip | |
- name: upload linux | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-linux-Release/c3-linux-Release.tar.gz | |
asset_name: c3-linux.tar.gz | |
asset_content_type: application/gzip | |
- name: upload linux debug | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-linux-Debug/c3-linux-Debug.tar.gz | |
asset_name: c3-linux-debug.tar.gz | |
asset_content_type: application/gzip | |
- name: upload ubuntu 20 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-ubuntu-20-Release/c3-ubuntu-20-Release.tar.gz | |
asset_name: c3-ubuntu-20.tar.gz | |
asset_content_type: application/gzip | |
- name: upload ubuntu 20 debug | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-ubuntu-20-Debug/c3-ubuntu-20-Debug.tar.gz | |
asset_name: c3-ubuntu-20-debug.tar.gz | |
asset_content_type: application/gzip | |
- name: upload macos | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-macos-Release/c3-macos-Release.zip | |
asset_name: c3-macos.zip | |
asset_content_type: application/zip | |
- name: upload macos debug | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: c3-macos-Debug/c3-macos-Debug.zip | |
asset_name: c3-macos-debug.zip | |
asset_content_type: application/zip |