Skip to content

Show a drop overlay when dragging firmware onto the list page #6026

Show a drop overlay when dragging firmware onto the list page

Show a drop overlay when dragging firmware onto the list page #6026

Workflow file for this run

name: Test + Docker
on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
pull_request:
jobs:
# Submit the dependency graph to GitHub. This needs `contents: write`, which is
# only granted on same-repo events — pull_request runs from forks get a
# read-only GITHUB_TOKEN regardless of `permissions:`, so submitting there
# would always 403. The graph only needs updating from the default branch
# anyway, so this never runs on pull_request.
submit_deps:
name: "Submit Mix Dependencies"
if: "${{ github.event_name != 'pull_request' }}"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: erlef/mix-dependency-submission@v1
# Review dependency changes introduced by a pull request. Read-only, so it runs
# fine on fork PRs.
dependency_review:
name: "Dependency Review"
if: "${{ github.event_name == 'pull_request' }}"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- uses: actions/dependency-review-action@v5
lint:
name: "Lint & Compile"
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
packages: read
env:
MIX_ENV: "test"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Elixir and dependencies
uses: ./.github/actions/setup
- name: Compiles without warnings
run: mix compile --warnings-as-errors
# needed for tailwind class formatting
- name: Install tailwindcss
run: mix tailwind.install
- name: Check Formatting
run: mix format --check-formatted
- name: Check for unused dependencies
run: mix deps.unlock --unused
- name: Check spelling
run: mix spellweaver.check
- name: Run Credo
run: mix credo --min-priority low
dialyzer:
name: "Dialyzer"
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
packages: read
env:
MIX_ENV: "test"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Elixir and dependencies
id: setup
uses: ./.github/actions/setup
- name: Restore PLT cache
uses: actions/cache/restore@v6
id: plt_cache
with:
key: |
${{ runner.os }}-${{ steps.setup.outputs.elixir-version }}-${{ steps.setup.outputs.otp-version }}-plt
restore-keys: |
${{ runner.os }}-${{ steps.setup.outputs.elixir-version }}-${{ steps.setup.outputs.otp-version }}-plt
path: |
priv/plts
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
- name: Save PLT cache
uses: actions/cache/save@v6
if: steps.plt_cache.outputs.cache-hit != 'true'
id: plt_cache_save
with:
key: |
${{ runner.os }}-${{ steps.setup.outputs.elixir-version }}-${{ steps.setup.outputs.otp-version }}-plt
path: |
priv/plts
- name: Run dialyzer
run: mix dialyzer --format github --format dialyxir
js-test:
name: "JS unit tests"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: "24"
# Dependency-free: runs on Node's built-in test runner, no npm install.
- name: Run JS unit tests
run: npm test --prefix assets
test:
name: "Test (${{ matrix.partition }}/3)"
runs-on: ubuntu-latest
timeout-minutes: 14
permissions:
contents: read
packages: read
strategy:
fail-fast: false
matrix:
partition: [1, 2, 3]
env:
FWUP_VERSION: "1.16.0"
MIX_ENV: "test"
DATABASE_URL: postgres://postgres:postgres@localhost:5432/nerves_hub_test
CLICKHOUSE_URL: http://default:@localhost:8123/default
MIX_TEST_PARTITION: ${{ matrix.partition }}
services:
db:
image: postgres:18
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
clickhouse:
image: clickhouse/clickhouse-server:25.4.2.31
env:
CLICKHOUSE_SKIP_USER_SETUP: 1
ports:
- "8123:8123"
- "9000:9000"
steps:
- name: Install fwup
run: |
wget https://github.com/fwup-home/fwup/releases/download/v${FWUP_VERSION}/fwup_${FWUP_VERSION}_amd64.deb
sudo dpkg -i fwup_${FWUP_VERSION}_amd64.deb && rm fwup_${FWUP_VERSION}_amd64.deb
- name: Install xdelta3 and mtools
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends xdelta3 mtools
# ESP-IDF deltas are detools patches, which is what esp_delta_ota reads on
# the device. Nothing else decodes them and there is no apt package.
- name: Install detools
run: pipx install detools || pip install --user detools
- name: Checkout
uses: actions/checkout@v7
- name: Set up Elixir and dependencies
uses: ./.github/actions/setup
- name: DB Setup
run: mix ecto.migrate.reset
- name: Run tests
run: mix test --partitions 3 --include mtools
build-and-publish:
name: "Build & Publish Docker image"
runs-on: ubuntu-latest
needs: [lint, dialyzer, test, js-test]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
env:
DOCKER_METADATA_PR_HEAD_SHA: true
with:
images: ghcr.io/nerves-hub/nerves-hub
tags: |
# short sha
type=sha,prefix=,suffix=,format=short
# branch image names, except for main
type=ref,enable=${{ github.ref != format('refs/heads/{0}', 'main') }},event=branch
# latest tag for main branch
type=raw,enable={{is_default_branch}},value=latest
# tag event (eg. "v1.2.3")
type=ref,event=tag
- name: Check if PR publish
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
id: pr_publish_check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
commits=$(gh pr view ${{ github.event.pull_request.number }} --json commits --jq '.commits[] | .messageHeadline + " " + .messageBody')
if [[ $commits =~ \[publish\] ]]; then
echo "true"
echo "publish=true" >> $GITHUB_OUTPUT
else
echo "false"
echo "publish=false" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
push: ${{ steps.pr_publish_check.outputs.publish == 'true' || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' || github.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max