diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fa6a380..028a583f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,34 +46,26 @@ jobs: run: cabal update - name: Build - run: cabal build all - - - name: Tests - run: cabal test all - - - name: Collect executable - if: runner.os != 'Windows' + shell: bash run: | mkdir -p artifacts - exe="$(find dist-newstyle \ - -type f \ - -path "*/x/openleetcode/build/openleetcode/openleetcode" \ - | head -n 1)" + cabal install exe:openleetcode \ + --installdir=artifacts \ + --install-method=copy \ + --overwrite-policy=always \ + --enable-executable-stripping - cp "$exe" "artifacts/${{ matrix.artifact }}" + - name: Finalize artifact + if: runner.os != 'Windows' + run: mv artifacts/openleetcode "artifacts/${{ matrix.artifact }}" - - name: Collect executable + - name: Finalize artifact if: runner.os == 'Windows' - shell: pwsh - run: | - New-Item -ItemType Directory -Force -Path artifacts - $exe = Get-ChildItem -Path dist-newstyle -Recurse -Filter "openleetcode.exe" | - Where-Object { - $_.FullName -like "*\x\openleetcode\build\openleetcode\openleetcode.exe" - } | - Select-Object -First 1 + shell: bash + run: mv artifacts/openleetcode.exe "artifacts/${{ matrix.artifact }}.exe" - Copy-Item $exe.FullName "artifacts/${{ matrix.artifact }}.exe" + - name: Tests + run: cabal test all - name: Smoke test if: runner.os != 'Windows' @@ -82,9 +74,8 @@ jobs: - name: Smoke test if: runner.os == 'Windows' - shell: pwsh - run: | - .\artifacts\${{ matrix.artifact }}.exe --version + shell: bash + run: ./artifacts/${{ matrix.artifact }}.exe --version - name: Upload artifacts uses: actions/upload-artifact@v4