You've already forked tribes-plugin-template
72 lines
1.7 KiB
YAML
72 lines
1.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:17
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
|
|
env:
|
|
MIX_ENV: test
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
elixir-version: "1.19"
|
|
otp-version: "27"
|
|
|
|
- name: Cache deps
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
deps
|
|
_build
|
|
key: ${{ runner.os }}-mix-${{ hashFiles('mix.lock') }}
|
|
restore-keys: ${{ runner.os }}-mix-
|
|
|
|
- name: Install dependencies
|
|
run: mix deps.get
|
|
|
|
- name: Compile (warnings as errors)
|
|
run: mix compile --warnings-as-errors
|
|
|
|
- name: Check formatting
|
|
run: mix format --check-formatted
|
|
|
|
- name: Run tests
|
|
run: mix test
|
|
|
|
- name: Validate manifest
|
|
run: |
|
|
elixir -e '
|
|
manifest = "manifest.json" |> File.read!() |> Jason.decode!()
|
|
required = ["name", "version", "entry_module", "host_api", "provides", "requires"]
|
|
missing = Enum.filter(required, &(not Map.has_key?(manifest, &1)))
|
|
if missing != [] do
|
|
IO.puts(:stderr, "Missing manifest fields: #{inspect(missing)}")
|
|
System.halt(1)
|
|
end
|
|
IO.puts("Plugin: #{manifest["name"]} v#{manifest["version"]}")
|
|
'
|