Skip to content

Commit

Permalink
WIP: Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jemc committed Aug 21, 2024
1 parent bd3eb31 commit 99bd599
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/library-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,54 @@ jobs:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, shell: bash }
- { os: macos-latest, shell: bash }
# - { os: ubuntu-latest, shell: bash }
# - { os: macos-latest, shell: bash }
- { os: windows-latest, shell: 'wsl-bash {0}' }
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
env:
LLVM_VERSION: 18 # (must also update Windows step below)
steps:
- uses: actions/checkout@v2
- uses: savi-lang/action-install@v1

- name: Install LLVM (Linux)
if: runner.os == 'Linux'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $LLVM_VERSION
sudo ln -s "/usr/lib/llvm-$LLVM_VERSION/lib/libLLVM-$LLVM_VERSION.so" "/usr/lib/llvm-$LLVM_VERSION/lib/libLLVM.so"
echo LIBRARY_PATH="/usr/lib/llvm-$LLVM_VERSION/lib" >> $GITHUB_ENV
- name: Install LLVM (MacOS)
if: runner.os == 'macOS'
run: |
brew install llvm@$LLVM_VERSION
echo LIBRARY_PATH="/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV
- name: Install LLVM0 (Windows step 1)
if: runner.os == 'Windows'
run: |
curl -o llvm-installer.exe "https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/LLVM-18.1.8-win64.exe"
ls -la ./llvm-installer.exe
chmod +x ./llvm-installer.exe
./llvm-installer.exe /S
echo COOL
# - name: Install LLVM (Windows step 2)
# if: runner.os == 'Windows'
# shell: powershell
# run: |
# Install-Module -Name WebKitDev -Force
# $baseurl = "https://github.com/llvm/llvm-project/releases/download"
# $url = "$baseurl/llvmorg-18.1.8/LLVM-18.1.8-win64.exe"
# $options = @( '/D=C:\Program Files\LLVM' )
# Install-FromExe -Name 'LLVM' -Url $url -Options $options -noVerify
# - name: Install LLVM2 (Windows step 3)
# if: runner.os == 'Windows'
# run: |
# ls C:\Program Files\LLVM

- run: savi deps update --for spec
- run: savi run spec ${{ runner.os == 'Windows' && '--cross-compile=x86_64-unknown-windows-msvc' || '' }}

Expand Down
6 changes: 3 additions & 3 deletions src/LLVM.Function.savi
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
:: Walk through each block in the function to return the block at the
:: given index. Raises an error if there are too few blocks to reach it.
:fun "[]!"(index USize) @->(LLVM.Block)
block = _FFI.Cast((LLVM.Block), @->(LLVM.Block)).pointer(
block = _FFI.Cast(LLVM.Block, @->(LLVM.Block)).pointer(
_FFI.get_first_basic_block(@)
)
while index.is_nonzero (
error! if block._ptr.is_null
index -= 1, block = _FFI.Cast((LLVM.Block), @->(LLVM.Block)).pointer(
index -= 1, block = _FFI.Cast(LLVM.Block, @->(LLVM.Block)).pointer(
_FFI.get_next_basic_block(block)
)
)
Expand Down Expand Up @@ -86,7 +86,7 @@
)
return unless block._ptr.is_not_null
distance = 0
while (index > from) (
while index > from (
index -= 1, block = _FFI.Cast(LLVM.Block, @->(LLVM.Block)).pointer(
_FFI.get_previous_basic_block(block)
)
Expand Down
2 changes: 1 addition & 1 deletion src/_FFI.savi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:ffi_link_lib "LLVM-18.1.8"
:ffi_link_lib "LLVM"

:module _FFI.Cast(A, B)
:: An FFI-only utility function for bit-casting type A to B.
Expand Down

0 comments on commit 99bd599

Please sign in to comment.