Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use flake . --impure
use flake . --override-input devenv-root "file+file://"<(printf %s "$PWD")
21 changes: 20 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,25 @@ body:
attributes:
label: Version
description: What version of TeslaMate are you running?
placeholder: v1.24.1
placeholder: v1.33.0
validations:
required: true

- type: input
id: postgresql_version
attributes:
label: PostgreSQL version
description: What version of PostgreSQL are you running? (see Database information dashboard -> PostgreSQL Version (upper right on desktop) or database -> image section in your `docker-compose.yml`)
placeholder: v17

- type: checkboxes
attributes:
label: Are you running latest major supported PostgreSQL version?
description: |
Please ensure you are running the latest major supported PostgreSQL version by comparing your installation with the [installation docs](https://docs.teslamate.org/docs/installation/docker/).

If not, please first do a backup and follow [Upgrading PostgreSQL to a new major version](https://docs.teslamate.org/docs/maintenance/upgrading_postgres)

options:
- label: I run the latest major supported PostgreSQL version
required: true
27 changes: 18 additions & 9 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
is_dockerhub_pushed:
description: "Need docker hub login?"
required: true
default: ''
default: ""
docker_password:
description: "Docker password"
required: true
Expand All @@ -30,37 +30,46 @@ inputs:
runs:
using: "composite"
steps:
- name: normalize version name to a valid string
# convert backslashes to dashes, so for example dependabot/x/y/z-1.2.3 works
id: normalize_version
shell: bash
run: |
VERSION="${{ inputs.version }}"
NORMALIZED_VERSION="${VERSION//\//-}"
echo "normalized_version=${NORMALIZED_VERSION}" >> $GITHUB_OUTPUT

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY_IMAGE }}
labels: |
{{ inputs.labels }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
- name: Login to Docker Hub
if: inputs.is_dockerhub_pushed != ''
uses: docker/login-action@v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
username: teslamate
password: ${{ inputs.docker_password }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ inputs.repository_owner }}
password: ${{ inputs.github_token }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5.0.0
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=registry,ref=ghcr.io/${{ inputs.repository }}:buildcache-${{ matrix.cache_id }}-${{ inputs.version }}
cache-to: type=registry,ref=ghcr.io/${{ inputs.repository }}:buildcache-${{ matrix.cache_id }}-${{ inputs.version }},mode=max
cache-from: type=registry,ref=ghcr.io/${{ inputs.repository }}:buildcache-${{ matrix.cache_id }}-${{ steps.normalize_version.outputs.normalized_version }}
cache-to: type=registry,ref=ghcr.io/${{ inputs.repository }}:buildcache-${{ matrix.cache_id }}-${{ steps.normalize_version.outputs.normalized_version }},mode=max
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
shell: bash
Expand All @@ -70,7 +79,7 @@ runs:
touch "/tmp/digests/${digest#sha256:}"
ls -l /tmp/digests/
- name: Upload digest
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: single-digest-${{ matrix.cache_id }}
path: /tmp/digests/*
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/grafana/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ runs:
steps:
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ inputs.image }}
tags: ${{ inputs.tags }}
labels: ${{ inputs.labels }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
- name: Build and push
uses: docker/build-push-action@v5.0.0
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0
with:
context: grafana
push: true
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/merge/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ runs:
using: "composite"
steps:
- name: Merge digests and reupload
uses: actions/upload-artifact/merge@v4
uses: actions/upload-artifact/merge@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: digests
pattern: single-digest-*

- name: Download merged digests
uses: actions/download-artifact@v4
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: digests
path: /tmp/digests

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ inputs.image }}
tags: ${{ inputs.tags }}
Expand Down
75 changes: 75 additions & 0 deletions .github/actions/setup-elixir-and-cache-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "Setup Elixir and Cache Dependencies"
description: "Setup Elixir, OTP and cache dependencies"
inputs:
elixir-version:
description: "Elixir version"
required: false
default: "1.17.3"
otp-version:
description: "OTP version"
required: false
default: "26"
cache-name-deps:
description: "Cache name for dependencies"
required: true
cache-name-compiled:
description: "Cache name for compiled build"
required: true
mix-env:
description: "Mix environment"
required: false
default: "dev"
ELIXIR_ASSERT_TIMEOUT:
description: "Elixir assert timeout"
required: false
default: "1000"
outputs:
elixir-version:
description: "The Elixir version used in the setup"
value: ${{ steps.beam.outputs.elixir-version }}
otp-version:
description: "The OTP version used in the setup"
value: ${{ steps.beam.outputs.otp-version }}
runs:
using: "composite"
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Setup Elixir and OTP
id: beam
uses: erlef/setup-beam@b9c58b0450cd832ccdb3c17cc156a47065d2114f # v1.18.1
with:
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}

- name: Cache deps
id: cache-deps
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: deps
key: ${{ runner.os }}-mix-${{ inputs.cache-name-deps }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ inputs.cache-name-deps }}-

- name: Cache compiled build
id: cache-build
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
_build
priv/cldr/locales
key: ${{ runner.os }}-mix-${{ inputs.cache-name-compiled }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ inputs.cache-name-compiled }}-
${{ runner.os }}-mix-

- name: Clean to rule out incremental build as a source of flakiness
if: github.run_attempt > 3
run: |
mix deps.clean --all
mix clean
shell: sh

- name: Install dependencies
run: mix deps.get
shell: sh
29 changes: 17 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
version: 2
updates:
# - package-ecosystem: "mix"
# directory: "/"
# schedule:
# interval: "monthly"
- package-ecosystem: "mix"
directory: "/"
schedule:
interval: "monthly"

# - package-ecosystem: "npm"
# directory: "/assets"
# schedule:
# interval: "monthly"
- package-ecosystem: "npm"
directory: "/assets"
schedule:
interval: "monthly"
ignore:
# ignore the path based dependencies to prevent "Dependabot couldn't fetch all your path-based dependencies"
- dependency-name: phoenix
- dependency-name: phoenix_html
- dependency-name: phoenix_live_view

# - package-ecosystem: "npm"
# directory: "/website"
# schedule:
# interval: "monthly"
- package-ecosystem: "npm"
directory: "/website"
schedule:
interval: "monthly"

- package-ecosystem: "docker"
directory: "/"
Expand Down
41 changes: 16 additions & 25 deletions .github/workflows/buildx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Publish Docker images

on:
workflow_dispatch:
workflow_call:
schedule:
- cron: "0 3 * * *"
push:
Expand All @@ -10,7 +11,8 @@ on:
paths:
- "**/*"
- "!.github/**" # Important: Exclude PRs related to .github from auto-run
- "!.github/workflows/**" # Important: Exclude PRs related to .github from auto-run
- "!.github/workflows/**" # Important: Exclude PRs related to .github/workflows from auto-run
- "!.github/actions/**" # Important: Exclude PRs related to .github/actions from auto-run
env:
REGISTRY_IMAGE: teslamate/teslamate

Expand All @@ -20,28 +22,17 @@ permissions:

jobs:
check_paths:
runs-on: ubuntu-latest
outputs:
githubfolder: ${{ steps.filter.outputs.githubfolder }}
steps:
- uses: actions/checkout@v4

- uses: dorny/[email protected]
id: filter
with:
filters: |
githubfolder:
- '.github/**'
uses: ./.github/workflows/check_paths.yml

teslamate_build:
needs: check_paths
if: needs.check_paths.outputs.githubfolder == 'false' || github.event_name == 'schedule'
if: needs.check_paths.outputs.githubfolder != 'true' || github.event_name == 'schedule'
strategy:
fail-fast: false
matrix:
include:
- platform: "linux/amd64"
runs_on: "ubuntu-latest"
runs_on: "ubuntu-24.04"
cache_id: amd64
- platform: "linux/arm/v7"
runs_on: "buildjet-2vcpu-ubuntu-2204-arm"
Expand All @@ -55,7 +46,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Buildx
uses: ./.github/actions/build
with:
Expand All @@ -64,20 +55,20 @@ jobs:
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ github.ref_name }}
version: ${{ github.head_ref || github.ref_name }}

teslamate_merge:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs:
- check_paths
- teslamate_build
if: needs.check_paths.outputs.githubfolder == 'false' || github.event_name == 'schedule'
if: needs.check_paths.outputs.githubfolder != 'true' || github.event_name == 'schedule'
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Login to Docker Hub
uses: docker/login-action@v3.2.0
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: teslamate
password: ${{ secrets.DOCKER_PASSWORD }}
Expand All @@ -92,15 +83,15 @@ jobs:
type=edge
grafana:
needs: check_paths
if: needs.check_paths.outputs.githubfolder == 'false' || github.event_name == 'schedule'
runs-on: ubuntu-latest
if: needs.check_paths.outputs.githubfolder != 'true' || github.event_name == 'schedule'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Login to Docker Hub
uses: docker/login-action@v3.2.0
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: teslamate
password: ${{ secrets.DOCKER_PASSWORD }}
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/check_paths.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check paths

on:
workflow_call:
# Map the workflow outputs to job outputs
outputs:
githubfolder:
description: "changes to .github folder"
value: ${{ jobs.check_paths.githubfolder }}

permissions:
contents: read

jobs:
check_paths:
runs-on: ubuntu-24.04
outputs:
githubfolder: ${{ steps.filter.outputs.githubfolder }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
base: "master" # needed to set as a called workflow does not have direct access to repository.default_branch
filters: |
githubfolder:
- '.github/**'
Loading
Loading