Compare commits
8 Commits
bump-versi
...
freebsd
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bfca3760c | |||
| 0f7f5347d8 | |||
| c74409b9a5 | |||
| 1c32dbc88a | |||
| ab17270761 | |||
| d0538a50e0 | |||
| 318ac21e41 | |||
| 3e9bb7c369 |
28
.cirrus.yml
28
.cirrus.yml
@@ -1,28 +0,0 @@
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-2
|
||||
|
||||
build_task:
|
||||
name: build
|
||||
env:
|
||||
GHC_VER: 9.4.8
|
||||
CABAL_VER: 3.10.2.0
|
||||
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
|
||||
ARCH: 64
|
||||
RUNNER_OS: FreeBSD
|
||||
DISTRO: na
|
||||
GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR}
|
||||
JSON_VERSION: "0.0.7"
|
||||
CIRRUS_CLONE_SUBMODULES: true
|
||||
AWS_ACCESS_KEY_ID: ENCRYPTED[6ed6287e2dd78ab5f84b22232c5245834ab042bd8ba443883aaf4b4d1ecc0481add1fdfad5ae6f6a8cfb418e6f19b2fc]
|
||||
AWS_SECRET_ACCESS_KEY: ENCRYPTED[16f3cda2954c7cee99444e6788eb5997382aa4ce1477e7523fef2586077541f43b5c816156961fc6b4677259679875a7]
|
||||
S3_HOST: ENCRYPTED[ce961780a33159f7d1d8046956b5ac6ebc3bfc8149428e5f538576cda51d9f3d0c35b79cdd1e325793639ff6e31f889d]
|
||||
install_script:
|
||||
- sed -i.bak -e 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
|
||||
- pkg install -y ghc hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake llvm14
|
||||
script:
|
||||
- tzsetup Etc/GMT
|
||||
- adjkerntz -a
|
||||
- bash .github/scripts/build.sh
|
||||
- bash .github/scripts/test.sh
|
||||
binaries_artifacts:
|
||||
path: "out/*"
|
||||
4
.github/scripts/env.sh
vendored
4
.github/scripts/env.sh
vendored
@@ -9,6 +9,10 @@ fi
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export TZ=Asia/Singapore
|
||||
|
||||
if [ "${RUNNER_OS}" = "freebsd" ] ; then
|
||||
export RUNNER_OS=FreeBSD
|
||||
fi
|
||||
|
||||
export OS="$RUNNER_OS"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
|
||||
2
.github/workflows/cross.yaml
vendored
2
.github/workflows/cross.yaml
vendored
@@ -19,7 +19,7 @@ env:
|
||||
jobs:
|
||||
build:
|
||||
name: Build linux binary
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: [self-hosted, Linux, X64, maerwald]
|
||||
env:
|
||||
CABAL_VER: 3.10.1.0
|
||||
JSON_VERSION: "0.0.7"
|
||||
|
||||
2
.github/workflows/docker.yaml
vendored
2
.github/workflows/docker.yaml
vendored
@@ -57,6 +57,7 @@ jobs:
|
||||
steps:
|
||||
- uses: docker://arm64v8/ubuntu:focal
|
||||
name: Cleanup (aarch64 linux)
|
||||
continue-on-error: true
|
||||
with:
|
||||
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
|
||||
|
||||
@@ -93,6 +94,7 @@ jobs:
|
||||
steps:
|
||||
- uses: docker://arm64v8/ubuntu:focal
|
||||
name: Cleanup (aarch64 linux)
|
||||
continue-on-error: true
|
||||
with:
|
||||
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
|
||||
|
||||
|
||||
91
.github/workflows/release.yaml
vendored
91
.github/workflows/release.yaml
vendored
@@ -94,20 +94,15 @@ jobs:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
include:
|
||||
- os: [self-hosted, Linux, ARM64]
|
||||
- os: [self-hosted, Linux, ARM64, maerwald]
|
||||
ARTIFACT: "armv7-linux-ghcup"
|
||||
GHC_VER: 9.2.8
|
||||
ARCH: ARM
|
||||
- os: [self-hosted, Linux, ARM64]
|
||||
- os: [self-hosted, Linux, ARM64, maerwald]
|
||||
ARTIFACT: "aarch64-linux-ghcup"
|
||||
GHC_VER: 9.4.8
|
||||
ARCH: ARM64
|
||||
steps:
|
||||
- uses: docker://arm64v8/debian:10
|
||||
name: Cleanup (aarch64 linux)
|
||||
with:
|
||||
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
|
||||
|
||||
- name: git config
|
||||
run: |
|
||||
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*"
|
||||
@@ -246,6 +241,42 @@ jobs:
|
||||
path: |
|
||||
./out/*
|
||||
|
||||
build-freebsd:
|
||||
name: Build binary (FreeBSD)
|
||||
runs-on: [self-hosted, FreeBSD, X64]
|
||||
env:
|
||||
CABAL_VER: 3.10.2.0
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.13
|
||||
JSON_VERSION: "0.0.8"
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
S3_HOST: ${{ secrets.S3_HOST }}
|
||||
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
|
||||
GHC_VER: 9.4.8
|
||||
ARCH: 64
|
||||
DISTRO: na
|
||||
RUNNER_OS: FreeBSD
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Run build
|
||||
run: |
|
||||
sed -i.bak -e 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
|
||||
pkg install -y ghc hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake llvm14 libiconv
|
||||
tzsetup Etc/GMT
|
||||
adjkerntz -a
|
||||
bash .github/scripts/build.sh
|
||||
- if: always()
|
||||
name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: artifacts
|
||||
path: |
|
||||
./out/*
|
||||
|
||||
test-linux:
|
||||
name: Test linux
|
||||
needs: "build-linux"
|
||||
@@ -334,23 +365,18 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: [self-hosted, Linux, ARM64]
|
||||
- os: [self-hosted, Linux, ARM64, maerwald]
|
||||
ARTIFACT: "armv7-linux-ghcup"
|
||||
GHC_VER: 9.2.8
|
||||
ARCH: ARM
|
||||
DISTRO: Ubuntu
|
||||
- os: [self-hosted, Linux, ARM64]
|
||||
- os: [self-hosted, Linux, ARM64, maerwald]
|
||||
ARTIFACT: "aarch64-linux-ghcup"
|
||||
GHC_VER: 9.4.8
|
||||
ARCH: ARM64
|
||||
DISTRO: Ubuntu
|
||||
|
||||
steps:
|
||||
- uses: docker://arm64v8/debian:10
|
||||
name: Cleanup (aarch64 linux)
|
||||
with:
|
||||
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
@@ -467,6 +493,41 @@ jobs:
|
||||
name: testfiles
|
||||
path: |
|
||||
./test/ghcup-test/golden/unix/GHCupInfo*json
|
||||
test-freebsd:
|
||||
name: Test FreeBSD
|
||||
needs: "build-freebsd"
|
||||
runs-on: [self-hosted, FreeBSD, X64]
|
||||
env:
|
||||
CABAL_VER: 3.10.2.0
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.13
|
||||
JSON_VERSION: "0.0.8"
|
||||
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
|
||||
GHC_VER: 9.4.8
|
||||
ARCH: 64
|
||||
DISTRO: na
|
||||
RUNNER_OS: FreeBSD
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out
|
||||
|
||||
- name: Run test
|
||||
run: |
|
||||
bash .github/scripts/test.sh
|
||||
|
||||
- if: failure()
|
||||
name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: testfiles
|
||||
path: |
|
||||
./test/ghcup-test/golden/unix/GHCupInfo*json
|
||||
hls:
|
||||
name: hls
|
||||
needs: build-linux
|
||||
@@ -500,7 +561,7 @@ jobs:
|
||||
|
||||
release:
|
||||
name: release
|
||||
needs: ["test-linux", "test-arm", "test-macwin", "hls"]
|
||||
needs: ["test-linux", "test-arm", "test-macwin", "test-freebsd", "hls"]
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
module BrickMain where
|
||||
|
||||
@@ -202,34 +203,35 @@ handleGenericListEvent (VtyEvent ev) = do
|
||||
handleGenericListEvent _ = pure ()
|
||||
|
||||
-- This re-uses Brick.Widget.List.renderList
|
||||
renderSectionList :: (Traversable t, Ord n, Show n, Eq n, L.Splittable t)
|
||||
renderSectionList :: forall n t e . (Traversable t, Ord n, Show n, Eq n, L.Splittable t, Semigroup (t e))
|
||||
=> (Bool -> e -> Widget n) -- ^ Rendering function of the list element, True for the selected element
|
||||
-> Bool -- ^ Whether the section list has focus
|
||||
-> GenericSectionList n t e -- ^ The section list to render
|
||||
-> Widget n
|
||||
renderSectionList render_elem section_focus (GenericSectionList focus elms sl_name) =
|
||||
Brick.Widget Brick.Greedy Brick.Greedy $ do
|
||||
c <- Brick.getContext
|
||||
let -- A section is focused if the whole thing is focused, and the inner list has focus
|
||||
section_is_focused l = section_focus && (Just (L.listName l) == F.focusGetCurrent focus)
|
||||
-- We need to limit the widget size when the length of the list is higher than the size of the terminal
|
||||
limit = min (Brick.windowHeight c) (Brick.availHeight c)
|
||||
s_idx = fromMaybe 0 $ V.findIndex section_is_focused elms
|
||||
render_inner_list has_focus l = Brick.vLimit (length l) $ L.renderList (\b -> render_elem (b && has_focus)) has_focus l
|
||||
(widget, off) =
|
||||
V.ifoldl' (\wacc i list ->
|
||||
let has_focus_list = section_is_focused list
|
||||
(!acc_widget, !acc_off) = wacc
|
||||
new_widget = if i == 0 then render_inner_list has_focus_list list else hBorder <=> render_inner_list has_focus_list list
|
||||
new_off
|
||||
| i < s_idx = 1 + L.listItemHeight list * length list
|
||||
| i == s_idx = 1 + L.listItemHeight list * fromMaybe 0 (L.listSelected list)
|
||||
| otherwise = 0
|
||||
in (acc_widget <=> new_widget, acc_off + new_off)
|
||||
)
|
||||
(Brick.emptyWidget, 0)
|
||||
elms
|
||||
Brick.render $ Brick.viewport sl_name Brick.Vertical $ Brick.translateBy (Brick.Location (0, min 0 (limit-off))) widget
|
||||
renderSectionList renderElem sectionFocus ge@(GenericSectionList focus elms slName) =
|
||||
Brick.Widget Brick.Greedy Brick.Greedy $ Brick.render $ Brick.viewport slName Brick.Vertical $
|
||||
V.ifoldl' (\(!accWidget) !i list ->
|
||||
let hasFocusList = sectionIsFocused list
|
||||
makeVisible = if hasFocusList then Brick.visibleRegion (Brick.Location (c, r)) (1, 1) else id
|
||||
appendBorder = if i == 0 then id else (hBorder <=>)
|
||||
newWidget = appendBorder (makeVisible $ renderInnerList hasFocusList list)
|
||||
in accWidget <=> newWidget
|
||||
)
|
||||
Brick.emptyWidget
|
||||
elms
|
||||
where
|
||||
-- A section is focused if the whole thing is focused, and the inner list has focus
|
||||
sectionIsFocused :: L.GenericList n t e -> Bool
|
||||
sectionIsFocused l = sectionFocus && (Just (L.listName l) == F.focusGetCurrent focus)
|
||||
|
||||
renderInnerList :: Bool -> L.GenericList n t e -> Widget n
|
||||
renderInnerList hasFocus l = Brick.vLimit (length l) $ L.renderList (\b -> renderElem (b && hasFocus)) hasFocus l
|
||||
|
||||
-- compute the location to focus on within the active section
|
||||
(c, r) :: (Int, Int) = case sectionListSelectedElement ge of
|
||||
Nothing -> (0, 0)
|
||||
Just (selElIx, _) -> (0, selElIx)
|
||||
|
||||
|
||||
-- | Equivalent to listSelectedElement
|
||||
sectionListSelectedElement :: (Eq n, L.Splittable t, Traversable t, Semigroup (t e)) => GenericSectionList n t e -> Maybe (Int, e)
|
||||
|
||||
Reference in New Issue
Block a user