Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Dec 13, 2023
2 parents 2908ec6 + 52550e5 commit b5b0c31
Show file tree
Hide file tree
Showing 144 changed files with 5,094 additions and 1,600 deletions.
2 changes: 1 addition & 1 deletion .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pull_request_rules:
conditions:
- label=merge me
- 'check-success=Frontend_tests'
- 'check-success=Backend_tests'
- 'check-success~=.*Backend_tests.*'
# - '#approved-reviews-by>=1'
# merge+squash strategy
- actions:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:

- name: Set up Haskell
id: setup-haskell
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
with:
ghc-version: "${{ matrix.ghc }}"
cabal-version: "latest"

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
Expand All @@ -71,6 +71,7 @@ jobs:
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/node_modules/.bin" >> $GITHUB_PATH
sudo apt install libsodium-dev
source ./environment.ci.sh
touch ~/.pgpass
chmod 0600 ~/.pgpass
Expand All @@ -83,7 +84,8 @@ jobs:
uses: actions/cache@v3.3.2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ghc-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}-

- name: Build
run: |
Expand All @@ -100,6 +102,6 @@ jobs:
migrate init "${FLORA_DB_CONNSTRING}"
migrate migrate "${FLORA_DB_CONNSTRING}" migrations
cabal run -- flora-cli create-user --username "hackage-user" --email "tech@flora.pm" --password "foobar2000"
cabal test
make test
env:
PGPASSWORD: "postgres"
8 changes: 2 additions & 6 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
name: Publish Docker Image

on:
pull_request:
paths:
- Dockerfile
- docker-compose.yml
- scripts/.zshrc
push:
branches: ["development"]
paths:
- Dockerfile
- docker-compose.yml
Expand All @@ -18,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nix-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- uses: cachix/install-nix-action@v24
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
- uses: cachix/cachix-action@v13
with:
name: flora-pm
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/test-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test Docker Image

on:
pull_request:
branches: ["main", "development"]
paths:
- Dockerfile
- docker-compose.yml
- scripts/.zshrc

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the hello-docker Docker image
run: make docker-build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
.hspec-failures
.vscode/
/.stack-work/
01-index
01-index*
<
Session.vim
_data/
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGELOG

## 1.0.14 -- 2023-12-13
* Colourise in red deprecation markers on the package page ([#438](/~https://github.com/flora-pm/flora-server/pull/439))
* Added more matches to the natural language processing category ([#440](/~https://github.com/flora-pm/flora-server/pull/440))
* Allow package imports from multiple repositories ([#444](/~https://github.com/flora-pm/flora-server/pull/444))
* Add a page on namespaces in the documentation ([#451](/~https://github.com/flora-pm/flora-server/pull/451))
* Add initial support for hosting package tarballs ([#452](/~https://github.com/flora-pm/flora-server/pull/452))
* Show depended on components in dependencies page ([#464](/~https://github.com/flora-pm/flora-server/pull/464))
* Add search bar for reverse dependencies ([#476](/~https://github.com/flora-pm/flora-server/pull/476))
* Support non Hackage repo URLs ([#479](/~https://github.com/flora-pm/flora-server/pull/479))
* Add description field in package index ([#486](/~https://github.com/flora-pm/flora-server/pull/486))
* Introduce search bar modifiers ([#487](/~https://github.com/flora-pm/flora-server/pull/487))

## 1.0.13 -- 2023-09-17
* Exclude deprecated releases from latest versions and search ([#373](/~https://github.com/flora-pm/flora-server/pull/373))
* Add namespace browsing ([#375](/~https://github.com/flora-pm/flora-server/pull/375))
Expand All @@ -11,6 +23,7 @@
* Fix the margins of the search bar in mobile view ([#430](/~https://github.com/flora-pm/flora-server/pull/430))
* Have proper breadcrumbs for the package page title ([#431](/~https://github.com/flora-pm/flora-server/pull/431))
* Configure the API gateway ([#432](/~https://github.com/flora-pm/flora-server/pull/432))
* Store and show the latest revision date of releases ([#437](/~https://github.com/flora-pm/flora-server/pull/437))

## 1.0.12 -- 2023-04-04

Expand Down
37 changes: 27 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ The compiler version used is described in the `cabal.project` file.
The following Haskell command-line tools will have to be installed:

* `postgresql-migration`: To perform schema migrations
* `fourmolu`: To style the code base. Minimum version is 0.12.0.0
* `fourmolu`: To style the code base. Version is 0.12.0.0
* `hlint` & `apply-refact`: To enforce certain patterns in the code base ("lint")
* `cabal-fmt` and `nixfmt`: To style the cabal and nix files
* `ghcid`: To automatically reload the Haskell code base upon source changes
* `ghc-tags`: To generate ctags or etags for the project

(Some of the above packages have incompatible dependencies, so don't try to install them all at once with `cabal install`)

You will need the [Soufflé datalog engine v2.3](/~https://github.com/souffle-lang/souffle/releases/tag/2.3)

* [Soufflé datalog engine v2.3](/~https://github.com/souffle-lang/souffle/releases/tag/2.3): The datalog engine for package classification
* `libsodium-1.0.18`: The system library that powers most of the cryptography happening in flora
* `yarn`: The tool that handles the JavaScript code bases
* `esbuild`: The tool that handles asset bundling

Expand Down Expand Up @@ -181,18 +181,35 @@ $ source environment.docker.sh
# You'll be in a tmux session, everything should be launched
# Visit localhost:8084 from your web browser to see if it all works.
```
### Provisioning the database
To provision the development database, type:
After everything is set up, (locally or via Docker), you can start populating the database:
```bash
$ make docker-enter
(docker)$ source environment.docker.sh
(docker)$ make db-drop # password is 'postgres' by default
(docker)$ make db-setup # password is 'postgres' by default
(docker)$ make db-provision
# And you should be good!
$ make db-setup
$ make db-provision
$ cabal run -- flora-cli create-user --admin --can-login --username "admin" \
--email "admin@localhost" --password "password123"
$ make db-provision-test-packages
```
### Importing a package index
The previous paragraph shows how to import test packages, but you may want to import a whole package index, for shit and giggles.
You can do so with:
```bash
$ cabal run flora-cli -- import-index ~/.cabal/packages/hackage.haskell.org/01-index.tar.gz \
--repository hackage.haskell.org
```
Similarly if you have the [cardano packages index](https://input-output-hk.github.io/cardano-haskell-packages/) configured, run:
```bash
$ cabal run flora-cli -- import-index ~/.cabal/packages/cardano/01-index.tar.gz \
--repository "cardano"
```
### Nix
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG GID=1000
ARG UID=1000

ARG ghc_version=9.4.5
ARG cabal_version=3.10.1.0
ARG cabal_version=3.10.2.0

# generate a working directory
USER "root"
Expand Down Expand Up @@ -41,7 +41,6 @@ RUN chmod ugo+x /home/$USER/.cabal

USER ${USER}
RUN git config --global --add safe.directory "*"
RUN ls -lh /home/$USER/.cabal
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh


Expand Down Expand Up @@ -84,6 +83,7 @@ RUN make souffle

# copy and build the assets
COPY --chown=${USER} assets ./assets
COPY --chown=${USER} docs ./docs
RUN make build-assets

USER root
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ db-migrate: ## Apply database migrations

db-reset: db-drop db-setup db-provision ## Reset the dev database

db-provision: build ## Load the development data in the database
db-provision: ## Create categories and repositories
@cabal run -- flora-cli create-user --username "hackage-user" --email "tech@flora.pm" --password "foobar2000"
@cabal run -- flora-cli provision categories
@cabal run -- flora-cli provision-repository --name "hackage" --url https://hackage.haskell.org \
--description "Central package repository"
@cabal run -- flora-cli provision-repository --name "cardano" --url https://input-output-hk.github.io/cardano-haskell-packages \
--description "Packages of the Cardano project"

db-provision-test-packages: ## Load development data in the database
@cabal run -- flora-cli provision test-packages

import-from-hackage: ## Imports every cabal file from the ./index-01 directory
Expand Down Expand Up @@ -102,6 +108,8 @@ tags: ## Generate ctags for the project with `ghc-tags`

design-system: ## Generate the HTML components used by the design system
@cabal run -- flora-cli gen-design-system
start-design-sysytem: ## Start storybook.js
@cd design; yarn storybook

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.* ?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand Down
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<p align="center">
<a href="/~https://github.com/flora-pm/flora-server/actions">
<img src="https://img.shields.io/github/actions/workflow/status/flora-pm/flora-server/backend.yml?branch=development&style=flat-square" alt="CI badge" />
<img src="https://img.shields.io/github/actions/workflow/status/flora-pm/flora-server/backend.yml?branch=development&style=flat-square&logo=github" alt="CI badge" />
</a>
<a href="https://haskell.org">
<img src="https://img.shields.io/badge/Made%20in-Haskell-%235e5086?logo=haskell&style=flat-square" alt="made with Haskell"/>
Expand All @@ -18,6 +18,16 @@
<a href="https://app.element.io/#/room/#flora-pm:matrix.org">
<img src="https://img.shields.io/badge/matrix-%23flora--pm%3Amatrix.org-brightgreen?style=flat-square&logo=matrix" alt="Matrix chatroom badge" />
</a>

<a href="https://functional.cafe/@flora_pm">
<img alt="Mastodon" src="https://img.shields.io/badge/Fediverse-%40flora_pm%40functional.cafe-blue?style=flat-square&logo=mastodon">

</a>

<a href="https://twitter.com/flora_haskell">
<img alt="Static Badge" src="https://img.shields.io/badge/Twitter-%40flora_haskell-blue?style=flat-square&logo=x">
</a>

</p>

<dl>
Expand All @@ -32,18 +42,22 @@
</p>
</dl>

**Read More**
## ⚡ Features

* [Code of Conduct](./CODE_OF_CONDUCT.md)
* [Contribution Guide](./CONTRIBUTING.md)
* [Development Wiki](/~https://github.com/flora-pm/flora-server/wiki)
* 📁 Curated category model, with elimination of duplicates
* 🏛️ Package namespaces, so that packages with the same name can live without conflict
* 🌓 Dark and light modes
* 📱 Mobile user interface

### Importing everything from Hackage
## 🤝 Contributing

1. Download the archive containing all packages [here](https://hackage.haskell.org/01-index.tar)
2. Extract it in Flora's root directory. You should now have a `01-index` folder
3. Run `make import-from-hackage`
We welcome new contributors! Join the [Matrix chatroom](https://app.element.io/#/room/#flora-pm:matrix.org) or open a [Discussion](/~https://github.com/flora-pm/flora-server/discussions/new/choose).

---
To setup a local installation, see [CONTRIBUTING.md#project-setup](/~https://github.com/flora-pm/flora-server/blob/development/CONTRIBUTING.md#project-setup)

You can explore the Makefile rules by typing `make` in your shell. I promise you it's worth it.
## 📖 Read More

* [Code of Conduct](./CODE_OF_CONDUCT.md)
* [Development Wiki](/~https://github.com/flora-pm/flora-server/wiki)

---
15 changes: 13 additions & 2 deletions app/cli/DesignSystem.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Flora.Model.Category
import Flora.Model.Category qualified as Category
import Flora.Model.Package
import Flora.Search
import FloraWeb.Components.Alert qualified as Component
import FloraWeb.Components.CategoryCard qualified as Component
import FloraWeb.Components.PackageListItem qualified as Component
import FloraWeb.Components.PaginationNav qualified as Component
Expand Down Expand Up @@ -69,15 +70,17 @@ components =
)
, ("category-card", ComponentTitle "Category", ComponentName "CategoryCard", categoryCardExample)
, ("pagination-area", ComponentTitle "Pagination Area", ComponentName "Pagination", paginationExample)
, ("alerts", ComponentTitle "Alerts", ComponentName "Alert", alertsExample)
]

-----------------------
-- Storybook Helpers --
-----------------------

storyTemplate :: ComponentTitle -> ComponentName -> TL.Text -> ByteString
storyTemplate (ComponentTitle title) (ComponentName name) html =
[fmt|
storyTemplate (ComponentTitle title) (ComponentName name) unprocessedHtml =
let html = TL.replace "\n" " " unprocessedHtml
in [fmt|
export default {{
title: "Components/{title}"
}};
Expand Down Expand Up @@ -124,3 +127,11 @@ paginationExample = div_ $ do
div_ $ do
h4_ "Next button"
Component.paginationNav 32 1 (SearchPackages "text")

alertsExample :: FloraHTML
alertsExample = div_ $ do
div_ $ do
h4_ "Info alert"
Component.info "Info alert"
h4_ "Error alert"
Component.exception "Error alert!"
Loading

0 comments on commit b5b0c31

Please sign in to comment.