-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
117 changed files
with
5,919 additions
and
4,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# editorconfig | ||
30db58ead8d80749c1ff86bacc3ef89899dae62f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.