Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Nov 1, 2024
2 parents 8fb5011 + 578cae5 commit 7a9cd9d
Show file tree
Hide file tree
Showing 117 changed files with 5,919 additions and 4,516 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.css]
indent_style = tab
indent_size = 2

[*.js]
indent_style = tab
indent_size = 4
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# editorconfig
30db58ead8d80749c1ff86bacc3ef89899dae62f
13 changes: 6 additions & 7 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout base repo
uses: actions/checkout@v4
- name: Extract the tested GHC versions
id: set-matrix
run: |
wget /~https://github.com/Kleidukos/get-tested/releases/download/v0.1.4.0/get-tested-0.1.4.0-linux-amd64 -O get-tested
chmod +x get-tested
./get-tested --ubuntu *.cabal >> $GITHUB_OUTPUT
uses: kleidukos/get-tested@v0.1.7.1
with:
cabal-file: flora.cabal
ubuntu-version: "latest"
version: 0.1.7.1

Backend_tests:
needs: generateMatrix
Expand Down Expand Up @@ -79,7 +78,7 @@ jobs:
cat ~/.pgpass
cabal update
- name: Cache
uses: actions/cache@v4.0.2
uses: actions/cache@v4.1.2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('./.plan.json') }}
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/check-duplicate-indexes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -euo pipefail

output="$(psql "$FLORA_DB_CONNSTRING" -f scripts/duplicate-indexes.sql)"

if [[ "$output" == *"(0 rows)"* ]]
then
exit 0
else
echo "Duplicate indexes! Run \`psql \"\$FLORA_DB_CONNSTRING\" -f scripts/duplicate-indexes.sql\` and remove them"
echo $output
exit 1
fi
23 changes: 0 additions & 23 deletions .github/workflows/check-flora-tickets-in-prs.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/check-missing-fk-indexes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -euo pipefail

output="$(psql "$FLORA_DB_CONNSTRING" -f scripts/missing-fk-indexes.sql 2>&1 > /dev/null)"

if [[ "$output" == *"Missing FK indexes"* ]]
then
echo "Missing FK index! Run \`psql \"\$FLORA_DB_CONNSTRING\" -f scripts/missing-fk-indexes.sql\` and apply them"
echo $output
exit 1
else
exit 0
fi
17 changes: 0 additions & 17 deletions .github/workflows/check-ticket-in-prs.sh

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/duplicate-indexes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Duplicate Indexes

on:
pull_request:
push:
branches: ["main", "development"]

concurrency:
group: duplicate-indexes-${{ github.ref_name }}
cancel-in-progress: true

jobs:
generateMatrix:
name: "Generate matrix from cabal"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/get-tested@v0.1.7.1
with:
cabal-file: flora.cabal
ubuntu-version: "latest"
version: 0.1.7.1

duplicate-index-check:
needs: generateMatrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4

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

- name: Configure environment
run: |
./.github/workflows/setup.sh
echo "/usr/lib/postgresql/14/bin/" >> $GITHUB_PATH
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH
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
echo "${FLORA_DB_HOST}:${FLORA_DB_PORT}:${FLORA_DB_DATABASE}:${FLORA_DB_USER}:${FLORA_DB_PASSWORD}" > .pgpass
cat ~/.pgpass
cabal update
- name: Cache
uses: actions/cache@v4.1.2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('./.plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}-


- name: Migrate
run: |
cabal install postgresql-migration
set -x
source ./environment.ci.sh
createdb -h "${FLORA_DB_HOST}" -p "${FLORA_DB_PORT}" -U "${FLORA_DB_USER}" -w "${FLORA_DB_DATABASE}"
migrate init "${FLORA_DB_CONNSTRING}"
migrate migrate "${FLORA_DB_CONNSTRING}" migrations
env:
PGPASSWORD: "postgres"

- name: Check
run: |
source ./environment.ci.sh
.github/workflows/check-duplicate-indexes.sh
7 changes: 1 addition & 6 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ jobs:
echo "$HOME/node_modules/.bin" >> $GITHUB_PATH
source ./environment.ci.sh
- uses: actionsx/prettier@v3
with:
# prettier CLI arguments.
args: --check ./assets/css

- name: Stylelint
- name: Stylelint
run: |
cd assets
yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: haskell-actions/run-fourmolu@v10
- uses: haskell-actions/run-fourmolu@v11
with:
version: "0.14.1.0"
pattern: |
Expand Down
97 changes: 97 additions & 0 deletions .github/workflows/missing-fk-indexes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Missing FK Indexes

on:
pull_request:
push:
branches: ["main", "development"]

concurrency:
group: missing-kf-indexes-${{ github.ref_name }}
cancel-in-progress: true

jobs:
generateMatrix:
name: "Generate matrix from cabal"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/get-tested@v0.1.7.1
with:
cabal-file: flora.cabal
ubuntu-version: "latest"
version: 0.1.7.1

missing-fk-index-check:
needs: generateMatrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4

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

- name: Configure environment
run: |
./.github/workflows/setup.sh
echo "/usr/lib/postgresql/14/bin/" >> $GITHUB_PATH
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH
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
echo "${FLORA_DB_HOST}:${FLORA_DB_PORT}:${FLORA_DB_DATABASE}:${FLORA_DB_USER}:${FLORA_DB_PASSWORD}" > .pgpass
cat ~/.pgpass
cabal update
- name: Cache
uses: actions/cache@v4.1.2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('./.plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}-


- name: Migrate
run: |
cabal install postgresql-migration
set -x
source ./environment.ci.sh
createdb -h "${FLORA_DB_HOST}" -p "${FLORA_DB_PORT}" -U "${FLORA_DB_USER}" -w "${FLORA_DB_DATABASE}"
migrate init "${FLORA_DB_CONNSTRING}"
migrate migrate "${FLORA_DB_CONNSTRING}" migrations
env:
PGPASSWORD: "postgres"

- name: Check
run: |
source ./environment.ci.sh
.github/workflows/check-missing-fk-indexes.sh
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## 1.0.21 -- 2024-11-01

- Add htmx polling for page reload [#579](/~https://github.com/flora-pm/flora-server/pull/579)
- Show last upload or revision date in packsge listings [#580](/~https://github.com/flora-pm/flora-server/pull/580)
- Add CI check for missing FK indexes [#605](/~https://github.com/flora-pm/flora-server/pull/605)
- Add more logging statements when importing packages [#778](/~https://github.com/flora-pm/flora-server/pull/778)

## 1.0.20 Hotfix release -- 2024-07-24

- Sort and limit the amount of releases in the DB instead of Flora [#567](/~https://github.com/flora-pm/flora-server/pull/567)
Expand Down
Loading

0 comments on commit 7a9cd9d

Please sign in to comment.