Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
d577856
Add our basic colors and change css generation to postcss (#2)
mpfeil Feb 16, 2023
3e074a0
WIP Explore map + dynamic device routes + bottom bar (#4)
freds-dev Feb 27, 2023
7941ec9
Add markers and clusters to map (#5)
mpfeil Mar 8, 2023
a011342
landing page (#7)
freds-dev Mar 22, 2023
97a6ab3
adjust styles with feedback from kim (#14)
freds-dev Apr 11, 2023
a927c55
Integrate directus CMS for landing page content (#11)
mpfeil Apr 19, 2023
0d839f1
Extend seed script to load actual data (#17)
mpfeil Apr 21, 2023
f61131d
device and geo search (location) (#12)
fab-scm Apr 25, 2023
cd362d9
Feat/shadcn installation (#20)
fab-scm Apr 26, 2023
ebf001e
Introduce i18n package and translate search component (#19)
mpfeil Apr 26, 2023
9247003
fix issue by `Ctrl` + `number` selection (#25)
fab-scm Apr 28, 2023
7504502
add search icon in navbar (#28)
fab-scm May 5, 2023
6fd85ae
Bottom bar feat line graph (#8)
freds-dev May 5, 2023
c644b21
Update chartjs deps to 4.3.0 to include @kurkle/color
mpfeil May 10, 2023
8fefde4
Switch from postgres to timescaledb docker image and activate tsdb on…
mpfeil May 11, 2023
722baef
Update chartjs deps to 4.3.0 to include @kurkle/color (#29)
mpfeil May 12, 2023
193fbd2
Replace maplibregl with mapboxgl (#31)
mpfeil May 23, 2023
2f6784e
Just one Mapbox token
mpfeil May 23, 2023
b5d8ddd
Conventions (#34)
mpfeil May 25, 2023
b6073a8
Merge branch 'feat/timescaledb' into dev
mpfeil May 25, 2023
95ddc80
Feat/graph loading (#32)
freds-dev May 30, 2023
efd4c90
Add shadow db (#35)
mpfeil May 30, 2023
b0dfea3
Don´t use fly.io anymore (#36)
mpfeil Jun 2, 2023
ff3addc
No need to move cache
mpfeil Jun 2, 2023
ff91823
Feat/date range picker (#30)
fab-scm Jun 6, 2023
847e354
Feat/MyBadges-integration (#21)
freds-dev Jun 11, 2023
bb97ca7
notification bell and menu bar next to each other
freds-dev Jun 11, 2023
1e5508b
Start updating landing page (#24)
mpfeil Jun 16, 2023
70cd548
Feat/public profiles (#45)
freds-dev Jun 21, 2023
8078eea
Feat/user management (#41)
YouQam Jun 21, 2023
89b70d9
Fix profile creation on signup
mpfeil Jun 23, 2023
eb6049b
Feat/style bottom bar components (#52)
freds-dev Jun 26, 2023
ca51dba
Add option to download sensor data Graph (#59)
freds-dev Jun 30, 2023
1b61aad
Add donut chart cluster (#46)
mpfeil Jul 3, 2023
e19b06f
Mobile device presentation (#65)
felixerdy Jul 11, 2023
b3a8573
Add dependabot configuration to scan for newer dependencies (#68)
mpfeil Jul 11, 2023
f461bdb
BoxMarker (#77)
felixerdy Jul 12, 2023
c7982e9
Build docker image and remove all fly.io leftovers (#81)
mpfeil Jul 12, 2023
cd9a1dd
Profile and Settings pages (#56)
mpfeil Jul 13, 2023
2d71a35
Add back original handler to fix server issues (#85)
mpfeil Jul 13, 2023
197c55c
add language selector to landing page (#61)
freds-dev Jul 14, 2023
4fce20f
add new device detail view (#91)
freds-dev Jul 22, 2023
949b13f
feat(BoxMarker): zIndex based on hover and status (#104)
felixerdy Jul 24, 2023
64c36ca
add sidebar on device explore route (#108)
freds-dev Jul 24, 2023
08264c3
Bump prettier-plugin-tailwindcss from 0.2.4 to 0.4.1 (#98)
dependabot[bot] Jul 25, 2023
35612d0
Bump lucide-react from 0.179.0 to 0.263.1 (#109)
dependabot[bot] Jul 25, 2023
21589a9
Timescale continues aggregates over 15min and 1day (#64)
mpfeil Jul 25, 2023
46184a8
Add retention policy to measurement table (#115)
mpfeil Jul 26, 2023
fd0cd59
change all heroicons to lucide icons (#114)
freds-dev Jul 26, 2023
c976b74
Add option to select predefined time range aggregates (#113)
mpfeil Jul 27, 2023
4cb469e
Add workflow to remove untagged images (#117)
mpfeil Jul 27, 2023
d624a6c
Feat/user management - new edit style (#119)
YouQam Jul 27, 2023
08e83da
Create profile for dummy user (#122)
mpfeil Jul 28, 2023
cea7163
Feat/device overview page (#120)
YouQam Jul 28, 2023
c2c86a6
Fix/branch too small (#123)
freds-dev Jul 28, 2023
46a7430
Add link to archive of a device closes #124 (#126)
mpfeil Jul 28, 2023
f65a952
Add status to sensor and stored procedures to set device and sensor s…
mpfeil Jul 28, 2023
0c4e74b
Add own docker compose file for ci without volume mapping (#127)
mpfeil Jul 28, 2023
ccbe106
(Mobile) Search bar (#66)
felixerdy Jul 31, 2023
c3ab9e4
Update main dependencies (#92)
mpfeil Aug 8, 2023
1f9a24a
Feat/compare devices (#136)
freds-dev Aug 8, 2023
941b86b
remove main html tag (#138)
freds-dev Aug 8, 2023
7b6f01b
download csv option (#139)
freds-dev Aug 9, 2023
ecb3cf2
csv header and sensor limitation (#141)
freds-dev Aug 9, 2023
ceebe71
minor styles changes to device detail and compare view (#142)
freds-dev Aug 10, 2023
4402932
fix issue on navigate (#143)
freds-dev Aug 11, 2023
7e2f70f
feat compare mode (#145)
freds-dev Aug 21, 2023
5658f78
Feat/date picker for graph (#149)
freds-dev Aug 21, 2023
b6491fc
add pricing plans to landing page (#140)
freds-dev Aug 21, 2023
e97c5f2
add time period buttons to query measurements in graph
freds-dev Aug 25, 2023
6dd5e66
keep search params for time and aggregation
freds-dev Aug 28, 2023
4134c4a
set spanGaps to false (#159)
freds-dev Aug 28, 2023
10c26b0
feat/better-mobile-view (#158)
freds-dev Sep 6, 2023
3950a22
Feat/donation (#151)
YouQam Sep 8, 2023
e89076f
Feat/filter options (#162)
YouQam Sep 8, 2023
8feb918
bug fix: access sensor measurement (#170)
YouQam Sep 12, 2023
70f4942
sign cookies and add refactored theme-provider (#176)
freds-dev Sep 18, 2023
8357d8a
add remix v2 convention (#171)
freds-dev Sep 18, 2023
c057388
bug fix: access sensor range (#178)
YouQam Sep 18, 2023
a0983c9
dark mode styling (#177)
freds-dev Sep 18, 2023
6ed64b6
Bump docker/build-push-action from 4 to 5 (#183)
dependabot[bot] Sep 19, 2023
975af13
Bump docker/metadata-action from 4 to 5 (#182)
dependabot[bot] Sep 19, 2023
51e384a
Bump docker/login-action from 2 to 3 (#181)
dependabot[bot] Sep 19, 2023
084b25b
replace tailwind class to silence warning (#185)
freds-dev Sep 19, 2023
deb58c1
just drop necessary searchParams (#186)
freds-dev Sep 19, 2023
69f190d
fix light theme search bar background
freds-dev Sep 22, 2023
f409ce0
Bump actions/checkout from 3 to 4 (#164)
dependabot[bot] Sep 22, 2023
8400361
Feat/remix v2 upgrade (#189)
freds-dev Sep 25, 2023
9e826a8
Bump docker/setup-buildx-action from 2 to 3 (#194)
dependabot[bot] Sep 26, 2023
3e83489
Filter options fix (#187)
YouQam Sep 26, 2023
1e87aa5
feat ErrorBoundaries (#195)
freds-dev Sep 27, 2023
2a74a10
go back on error message exit button (#196)
freds-dev Sep 27, 2023
d7ba14a
Bump @types/compression from 1.7.2 to 1.7.3 (#191)
dependabot[bot] Sep 27, 2023
b2193fc
Fix mydevices issue with v2 (#197)
YouQam Sep 29, 2023
ff1ee9d
Bump supercluster from 7.1.5 to 8.0.1 (#192)
dependabot[bot] Sep 29, 2023
c699036
Refresh sensor values (#198)
YouQam Oct 2, 2023
af48293
Bump class-variance-authority from 0.5.3 to 0.7.0 (#131)
dependabot[bot] Oct 4, 2023
bd67b1a
Bump vitest from 0.32.4 to 0.34.6 (#202)
dependabot[bot] Oct 4, 2023
e462270
Bump nick-fields/retry from 2.8.3 to 2.9.0 (#203)
dependabot[bot] Oct 4, 2023
0fe69ba
Bump @radix-ui/react-navigation-menu from 1.1.2 to 1.1.4 (#193)
dependabot[bot] Oct 8, 2023
2ab5c50
Bump @radix-ui/react-dialog from 1.0.4 to 1.0.5 (#200)
dependabot[bot] Oct 8, 2023
1453795
Bump shadcn-ui from 0.2.2 to 0.4.0 (#201)
dependabot[bot] Oct 8, 2023
9888131
update `package-lock.json`
freds-dev Oct 8, 2023
196ed2c
Feat/sensor wiki connection (#118)
umut0 Oct 11, 2023
0ce4383
Bump postcss from 8.4.30 to 8.4.31 (#204)
dependabot[bot] Oct 11, 2023
44ab61e
Bump prom-client from 14.2.0 to 15.0.0 (#205)
dependabot[bot] Oct 11, 2023
c12c251
Bump eslint-plugin-unicorn from 47.0.0 to 48.0.1 (#206)
dependabot[bot] Oct 11, 2023
054987f
Bump @radix-ui/react-toast from 1.1.3 to 1.1.5 (#208)
dependabot[bot] Oct 11, 2023
530fd86
Bump cypress-io/github-action from 5 to 6 (#156)
dependabot[bot] Oct 11, 2023
b06dcac
remove lottie (#210)
freds-dev Oct 12, 2023
459fe38
add missing qs package
mpfeil Oct 13, 2023
490339e
Bump esbuild from 0.19.3 to 0.19.4 (#213)
dependabot[bot] Oct 17, 2023
9191929
Bump @types/supercluster from 7.1.0 to 7.1.1 (#216)
dependabot[bot] Oct 17, 2023
e771454
Bump react-day-picker from 8.7.1 to 8.9.0 (#215)
dependabot[bot] Oct 17, 2023
e2348c2
Bump @radix-ui/react-tooltip from 1.0.6 to 1.0.7 (#214)
dependabot[bot] Oct 17, 2023
21237e5
Bump cypress from 12.17.3 to 13.3.1 (#217)
dependabot[bot] Oct 17, 2023
148f6e4
add new colors from scheme (#218)
freds-dev Oct 19, 2023
1fb4ddb
Single device page v2 (#212)
YouQam Oct 26, 2023
21bc55c
Bump actions/setup-node from 3 to 4 (#226)
dependabot[bot] Oct 26, 2023
e631f3b
Bump prettier from 3.0.2 to 3.0.3 (#222)
dependabot[bot] Oct 26, 2023
f650fba
Bump framer-motion from 10.12.4 to 10.16.4 (#220)
dependabot[bot] Oct 26, 2023
ce53238
Consolidate settings and dashboard pages (#211)
YouQam Nov 2, 2023
bacd351
Bump @vitest/coverage-v8 from 0.34.5 to 0.34.6 (#224)
dependabot[bot] Nov 2, 2023
6aa5760
Bump i18next-http-backend from 2.2.0 to 2.3.1 (#229)
dependabot[bot] Nov 2, 2023
a6e0e40
Bump @testing-library/cypress from 9.0.0 to 10.0.1 (#230)
dependabot[bot] Nov 2, 2023
a8e0d51
Bump @types/geojson from 7946.0.10 to 7946.0.12 (#232)
dependabot[bot] Nov 7, 2023
f4b488f
Bump react-day-picker from 8.9.0 to 8.9.1 (#231)
dependabot[bot] Nov 7, 2023
7ab6380
refactor filters (#227)
freds-dev Nov 22, 2023
cf43b35
Bump @conform-to/react from 0.9.0 to 0.9.1 (#236)
dependabot[bot] Nov 22, 2023
7850391
Bump @radix-ui/react-alert-dialog from 1.0.4 to 1.0.5 (#233)
dependabot[bot] Nov 22, 2023
535ac36
Feat/mqtt check connection (#209)
YouQam Nov 27, 2023
98d9361
Bump @hookform/resolvers from 3.3.1 to 3.3.2 (#241)
dependabot[bot] Nov 28, 2023
d764120
Bump lucide-react from 0.263.1 to 0.293.0 (#240)
dependabot[bot] Nov 28, 2023
4cf92b3
Bump cypress from 13.3.1 to 13.6.0 (#244)
dependabot[bot] Dec 6, 2023
454f373
Bump clsx from 1.2.1 to 2.0.0 (#243)
dependabot[bot] Dec 6, 2023
ef3a669
Bump cookie from 0.5.0 to 0.6.0 (#246)
dependabot[bot] Dec 13, 2023
c4782a4
Bump cypress from 13.6.0 to 13.6.1 (#247)
dependabot[bot] Dec 13, 2023
432cd4f
Bump prettier from 3.0.3 to 3.1.1 (#250)
dependabot[bot] Jan 7, 2024
19bb21b
Bump prettier-plugin-tailwindcss from 0.5.4 to 0.5.11 (#253)
dependabot[bot] Jan 26, 2024
9c0443f
Bump ts-node from 10.9.1 to 10.9.2 (#254)
dependabot[bot] Mar 4, 2024
3fabc31
Bump vlaurin/action-ghcr-prune from 0.5.0 to 0.6.0 (#260)
dependabot[bot] Mar 4, 2024
e3778a3
Bump nick-fields/retry from 2.9.0 to 3.0.0 (#264)
dependabot[bot] Mar 4, 2024
056a250
build all PR images
freds-dev Mar 4, 2024
cc089e0
Bump @radix-ui/react-select from 1.2.2 to 2.0.0 (#274)
dependabot[bot] Mar 6, 2024
5c486b9
Bump react-hook-form from 7.46.2 to 7.51.0 (#277)
dependabot[bot] Mar 13, 2024
573363b
use drizzle instead of prisma (#228)
mpfeil Mar 18, 2024
85b2c24
Bump vite from 4.5.2 to 5.1.6 (#281)
dependabot[bot] Mar 19, 2024
b5dc81a
Bump vitest from 0.34.6 to 1.4.0 (#279)
dependabot[bot] Mar 25, 2024
c5ebc7e
Bump node from 18-bullseye-slim to 21-bullseye-slim (#225)
dependabot[bot] Mar 25, 2024
7929bf9
Bump @remix-run/eslint-config from 2.0.1 to 2.8.1 (#283)
dependabot[bot] Mar 26, 2024
5379d0a
Bump prettier from 3.1.1 to 3.2.5 (#282)
dependabot[bot] Mar 26, 2024
e400d93
Bump @types/supercluster from 7.1.1 to 7.1.3 (#285)
dependabot[bot] Apr 8, 2024
6111583
Bump @types/morgan from 1.9.4 to 1.9.9 (#286)
dependabot[bot] Apr 8, 2024
ca4b012
fetch live stats from osem api (#288)
freds-dev Apr 8, 2024
37b7ef2
Bump spin-delay from 1.2.0 to 2.0.0 (#290)
dependabot[bot] Apr 10, 2024
f5d4435
Bump tailwindcss from 3.3.0 to 3.4.3 (#291)
dependabot[bot] Apr 10, 2024
355de4c
fix tailwind theme cookie (#289)
freds-dev Apr 10, 2024
86a818d
exclude donation section for now
freds-dev Apr 10, 2024
a213a77
add hash for position on map (#292)
freds-dev Apr 12, 2024
6b267b6
Bump @testing-library/dom from 8.20.0 to 10.0.0 (#294)
dependabot[bot] Apr 18, 2024
0d374c5
Bump zod-form-data from 2.0.1 to 2.0.2 (#298)
dependabot[bot] Apr 23, 2024
3ef8f8f
Feat/new input options (#296)
freds-dev Apr 25, 2024
d60dcac
new input method for phenomenon selection (#299)
freds-dev Apr 26, 2024
b2236b4
Bump actions/cache from 3 to 4 (#258)
dependabot[bot] May 3, 2024
dc97d13
Bump dotenv from 16.3.1 to 16.4.5 (#302)
dependabot[bot] May 13, 2024
0984ecf
--- (#310)
dependabot[bot] Jun 4, 2024
6df2de4
Use `snake_case` for database columns (#315)
mpfeil Jul 3, 2024
47fb765
fix layouts (#305)
freds-dev Jul 3, 2024
c68fc00
Bump docker/build-push-action from 5 to 6 (#313)
dependabot[bot] Jul 12, 2024
d5b822e
feat: new materialized views (#320)
mpfeil Jul 12, 2024
c92fdcf
rename sensor wiki fields to snake_case (#321)
mpfeil Jul 12, 2024
17e214e
fix: show sensor details in device detail sidebar (#322)
mpfeil Jul 21, 2024
4d4d3cf
add all views to be queried (#324)
mpfeil Jul 22, 2024
da66c70
Bump node from 21-bullseye-slim to 22-bullseye-slim (#301)
dependabot[bot] Jul 25, 2024
6396c25
upgrade drizzle-orm and drizzle-kit to latest versions and use new fe…
mpfeil Jul 25, 2024
4394d9f
Fix `Graph`, add close button and modify colors (#331)
freds-dev Jul 27, 2024
8b34630
Fix/modals in safari (#336)
freds-dev Jul 29, 2024
a3a9d13
change LATERAL join to left join to get back results if no last measu…
mpfeil Jul 29, 2024
5d239a0
chore: add missing link and image columns (#339)
mpfeil Jul 31, 2024
382d168
use correct status enum (#340)
mpfeil Jul 31, 2024
02220d9
fix: queries with date ranges (#341)
mpfeil Aug 1, 2024
6367a7c
chore: new landing page (#342)
mpfeil Aug 2, 2024
04f8dc2
feat: device compare mode (#338)
freds-dev Aug 5, 2024
1f33349
Feat/prepare menu for beta (#345)
freds-dev Aug 5, 2024
8d45a55
chore: add simple imprint and privacy pages (#348)
mpfeil Aug 7, 2024
89ac73b
Feat/secure db queries (#349)
freds-dev Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 42 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"
# SHADOW_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"

PG_CLIENT_SSL="false"

SESSION_SECRET="super-duper-s3cret"

MAPBOX_ACCESS_TOKEN=""
MAPBOX_GEOCODING_API="https://api.mapbox.com/geocoding/v5/mapbox.places/"

OSEM_API_URL="https://api.opensensemap.org/"
DIRECTUS_URL="https://coelho.opensensemap.org"
SENSORWIKI_API_URL="https://api.sensors.wiki/"


MYBADGES_API_URL = "https://api.v2.mybadges.org/"
MYBADGES_URL = "https://mybadges.org/"
MYBADGES_SERVERADMIN_USERNAME = ""
MYBADGES_SERVERADMIN_PASSWORD = ""
MYBADGES_ISSUERID_OSEM = ""
MYBADGES_CLIENT_ID = ""
MYBADGES_CLIENT_SECRET = ""

NOVU_API_URL = ""
NOVU_WEBSOCKET_URL = ""
NOVU_APPLICATION_IDENTIFIER = ""

SENSORWIKI_API_URL="https://api.sensors.wiki/"

MYBADGES_API_URL = "https://api.v2.mybadges.org/"
MYBADGES_URL = "https://mybadges.org/"
MYBADGES_SERVERADMIN_USERNAME = ""
MYBADGES_SERVERADMIN_PASSWORD = ""
MYBADGES_ISSUERID_OSEM = ""
MYBADGES_CLIENT_ID = ""
MYBADGES_CLIENT_SECRET = ""

NOVU_API_URL = ""
NOVU_WEBSOCKET_URL = ""
NOVU_APPLICATION_IDENTIFIER = ""

# login to testing.opensensemap.org to register box in testing database (use your own account for now)
TESTING_ACCOUNT=""
TESTING_PW="test1234"
26 changes: 25 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
env: {
"cypress/globals": true,
},
plugins: ["cypress"],
plugins: ["cypress", "unicorn"],
// We're using vitest which has a very similar API to jest
// (so the linting plugins work nicely), but we have to
// set the jest version explicitly.
Expand All @@ -18,4 +18,28 @@ module.exports = {
version: 28,
},
},
// Enable kebabCase filename convention for all files
rules: {
"unicorn/filename-case": [
"error",
{
case: "kebabCase",
},
],
},
// But disable kebabCase filename convention for all files
// in /app/routes because of remix.run filename conventions
overrides: [
{
files: [
"app/routes/**/*.ts",
"app/routes/**/*.js",
"app/routes/**/*.tsx",
"app/routes/**/*.jsx",
],
rules: {
"unicorn/filename-case": "off",
},
},
],
};
15 changes: 15 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
167 changes: 63 additions & 104 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
name: 🚀 Deploy
name: 🏗️ Build
on:
push:
branches:
- main
- dev
pull_request: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
actions: write
contents: read
packages: write

jobs:
lint:
name: ⬣ ESLint
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0

- name: ⬇️ Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: ⎔ Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm
cache-dependency-path: ./package.json
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: 📥 Install deps
run: npm install

- name: 🔬 Lint
run: npm run lint
Expand All @@ -38,21 +40,18 @@ jobs:
name: ʦ TypeScript
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0

- name: ⬇️ Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: ⎔ Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm
cache-dependency-path: ./package.json
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: 📥 Install deps
run: npm install

- name: 🔎 Type check
run: npm run typecheck --if-present
Expand All @@ -61,21 +60,18 @@ jobs:
name: ⚡ Vitest
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0

- name: ⬇️ Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: ⎔ Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm
cache-dependency-path: ./package.json
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: 📥 Install deps
run: npm install

- name: ⚡ Run vitest
run: npm run test -- --coverage
Expand All @@ -84,91 +80,91 @@ jobs:
name: ⚫️ Cypress
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0

- name: ⬇️ Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: 🏄 Copy test env vars
run: cp .env.example .env

- name: ⎔ Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm
cache-dependency-path: ./package.json
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: 📥 Install deps
run: npm install

- name: 🐳 Docker compose
# the sleep is just there to give time for postgres to get started
run: docker-compose up -d && sleep 3
run: docker compose -f docker-compose.ci.yml up -d && sleep 60
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"

- name: 🛠 Setup Database
run: npx prisma migrate reset --force
uses: nick-fields/retry@v3.0.0
with:
timeout_minutes: 10
max_attempts: 5
retry_wait_seconds: 45
retry_on: error
command: npm run drizzle:migrate

- name: ⚙️ Build
run: npm run build

- name: 🌳 Cypress run
uses: cypress-io/github-action@v5
uses: cypress-io/github-action@v6
with:
start: npm run start:mocks
wait-on: "http://localhost:8811"
wait-on: http://localhost:8811
env:
PORT: "8811"
PORT: 8811

build:
name: 🐳 Build
# only build/deploy main branch on pushes
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
# if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0

- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: 👀 Read app name
uses: SebRollen/toml-action@v1.0.2
id: app_name
with:
file: "fly.toml"
field: "app"
uses: actions/checkout@v4

- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
version: v0.9.1

# Setup cache
- name: ⚡️ Cache Docker layers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: 🔑 Fly Registry Auth
uses: docker/login-action@v2
- name: 📋 Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/opensensemap/frontend

- name: 🔑 GitHub Registry Auth
uses: docker/login-action@v3
with:
registry: registry.fly.io
username: x
password: ${{ secrets.FLY_API_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 🐳 Docker build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT_SHA=${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
Expand All @@ -183,40 +179,3 @@ jobs:
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

deploy:
name: 🚀 Deploy
runs-on: ubuntu-latest
needs: [lint, typecheck, vitest, cypress, build]
# only build/deploy main branch on pushes
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}

steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0

- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: 👀 Read app name
uses: SebRollen/toml-action@v1.0.2
id: app_name
with:
file: "fly.toml"
field: "app"

- name: 🚀 Deploy Staging
if: ${{ github.ref == 'refs/heads/dev' }}
uses: superfly/flyctl-actions@1.3
with:
args: "deploy --app ${{ steps.app_name.outputs.value }}-staging --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: 🚀 Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
uses: superfly/flyctl-actions@1.3
with:
args: "deploy --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/purge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 🗑️ Purge untagged images
on:
schedule:
- cron: "0 0 * * *"

permissions:
packages: write

jobs:
purge_untagged_images:
runs-on: ubuntu-latest
steps:
- name: 🧹 Remove untagged images
uses: vlaurin/action-ghcr-prune@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: ${{ github.repository_owner}}
container: ${{ github.event.repository.name }}
prune-untagged: true
Loading