From 14726d7cf87b9b370820fe0c6493a87134b2d6bd Mon Sep 17 00:00:00 2001 From: zach Date: Mon, 22 Jan 2024 13:34:30 -0800 Subject: [PATCH] ci: disable windows, install extism lib --- .github/actions/libextism/action.yml | 17 +++++++++++++++++ .github/workflows/ci.yml | 23 +++++++++++++---------- lakefile.lean | 7 +++++-- 3 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 .github/actions/libextism/action.yml diff --git a/.github/actions/libextism/action.yml b/.github/actions/libextism/action.yml new file mode 100644 index 0000000..72e50dc --- /dev/null +++ b/.github/actions/libextism/action.yml @@ -0,0 +1,17 @@ +on: [workflow_call] + +name: libextism + +runs: + using: composite + steps: + - uses: actions/checkout@v3 + with: + repository: extism/cli + path: .extism-cli + - uses: ./.extism-cli/.github/actions/extism-cli + - name: Install + shell: bash + run: sudo extism lib install --version git + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3705eb4..f61dd16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,8 @@ jobs: include: - name: Linux os: ubuntu-latest - - name: Windows - os: windows-latest + # - name: Windows + # os: windows-latest - name: macOS os: macos-latest @@ -20,6 +20,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - uses: ./.github/actions/libextism + env: + GITHUB_TOKEN: ${{ github.token }} - name: Setup elan toolchain on Linux or macOS if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' @@ -30,14 +33,14 @@ jobs: echo "Adding location $HOME/.elan/bin to PATH..." echo "$HOME/.elan/bin" >> $GITHUB_PATH - - name: Setup elan toolchain on Windows - if: matrix.os == 'windows-latest' - shell: pwsh - run: | - curl -O --location https://raw.githubusercontent.com/leanprover/elan/master/elan-init.ps1 - .\elan-init.ps1 -NoPrompt 1 -DefaultToolchain leanprover/lean4:nightly - echo "Adding location $HOME\.elan\bin to PATH..." - echo "$HOME\.elan\bin" >> $env:GITHUB_PATH + # - name: Setup elan toolchain on Windows + # if: matrix.os == 'windows-latest' + # shell: pwsh + # run: | + # curl -O --location https://raw.githubusercontent.com/leanprover/elan/master/elan-init.ps1 + # .\elan-init.ps1 -NoPrompt 1 -DefaultToolchain leanprover/lean4:nightly + # echo "Adding location $HOME\.elan\bin to PATH..." + # echo "$HOME\.elan\bin" >> $env:GITHUB_PATH - name: Test elan & lean are working run: | diff --git a/lakefile.lean b/lakefile.lean index 69eb760..6806079 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -2,9 +2,12 @@ import Lake open Lake DSL +def extismIncludePath := "/usr/local/include" +def extismLibPath := "/usr/local/lib" + package extism { -- precompileModules := true - moreLinkArgs := #["-lextism"] + moreLinkArgs := #["-L" ++ extismLibPath, "-lextism"] } lean_lib Extism @@ -18,7 +21,7 @@ lean_exe test { target bindings.o pkg : FilePath := do let oFile := pkg.buildDir / "c" / "bindings.o" let srcJob ← inputFile <| pkg.dir / "c" / "bindings.c" - let weakArgs := #["-I", (← getLeanIncludeDir).toString, "-I", "/usr/local/include"] + let weakArgs := #["-I", (← getLeanIncludeDir).toString, "-I", extismIncludePath] buildO "bindings.c" oFile srcJob weakArgs #["-fPIC", "--std=c11"] "cc" getLeanTrace extern_lib libleanextism pkg := do