create the CI #1

Open
thinkode wants to merge 38 commits from 6-create-the-ci into develop
9 changed files with 362 additions and 279 deletions

View File

@@ -0,0 +1,46 @@
name: Check software
on: [push]
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.21.4'
cache: true
- name: Install dependencies
run: go mod tidy
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
- name: Run golangci-lint
run: |
$(go env GOPATH)/bin/golangci-lint run
# - name: Build
# run: go build -v ./...
# - name: Run tests with race detector
# run: go test -v -race ./...
# - name: Run tests and generate coverage report
# run: go test -v -coverprofile=coverage.out ./...
# - name: Display coverage
# run: go tool cover -func=coverage.out
# - name: Upload coverage report
# uses: actions/upload-artifact@v3
# with:
# name: coverage-report
# path: coverage.out

33
Taskfile.yml Normal file
View File

@@ -0,0 +1,33 @@
version: '3'
vars:
# Get the application name
repo_name:
sh: basename `git config --get remote.origin.url` .git
repo_version:
sh: |
tag=$(git describe --tags --abbrev=0 2>/dev/null || true)
if [ -z "$tag" ]; then
git rev-parse HEAD
else
echo $tag
fi
tasks:
# Installing the dependencies to develop dmxconnect
install:
cmds:
- echo "Installing dependencies to contribute to {{.repo_name}}..."
silent: true
# Running the application
run:
cmds:
- echo "Running {{.repo_name}}..."
silent: true
# Building the application
build:
cmds:
- echo "Generating {{.repo_name}}_v{{.repo_version}}.deb ..."
silent: true

View File

@@ -1,54 +1,54 @@
<script> <script>
import logo from './assets/images/logo-universal.png' import logo from './assets/images/logo-universal.png'
import {Greet} from '../wailsjs/go/main/App.js' import {Greet} from '../wailsjs/go/main/App.js'
import { _ } from 'svelte-i18n' import { _ } from 'svelte-i18n'
import NavigationBar from './components/NavigationBar.svelte'; import NavigationBar from './components/NavigationBar.svelte';
import Clock from './components/Clock.svelte' import Clock from './components/Clock.svelte'
import Preparation from './components/Preparation.svelte'; import Preparation from './components/Preparation.svelte';
import Animation from './components/Animation.svelte'; import Animation from './components/Animation.svelte';
import Settings from './components/Settings.svelte'; import Settings from './components/Settings.svelte';
import Devices from './components/Devices.svelte'; import Devices from './components/Devices.svelte';
import Show from './components/Show.svelte'; import Show from './components/Show.svelte';
import GeneralConsole from './components/GeneralConsole.svelte'; import GeneralConsole from './components/GeneralConsole.svelte';
let selectedMenu = "settings" let selectedMenu = "settings"
// When the navigation menu changed, update the selected menu // When the navigation menu changed, update the selected menu
function onNavigationChanged(event){ function onNavigationChanged(event){
selectedMenu = event.detail.menu; selectedMenu = event.detail.menu;
} }
</script> </script>
<header> <header>
<NavigationBar on:navigationChanged="{onNavigationChanged}"/> <NavigationBar on:navigationChanged="{onNavigationChanged}"/>
<Clock/> <Clock/>
</header> </header>
<main> <main>
{#if selectedMenu === "settings"} {#if selectedMenu === "settings"}
<Settings /> <Settings />
{:else if selectedMenu === "devices"} {:else if selectedMenu === "devices"}
<Devices /> <Devices />
{:else if selectedMenu === "preparation"} {:else if selectedMenu === "preparation"}
<Preparation /> <Preparation />
{:else if selectedMenu === "animation"} {:else if selectedMenu === "animation"}
<Animation /> <Animation />
{:else if selectedMenu === "show"} {:else if selectedMenu === "show"}
<Show /> <Show />
{:else if selectedMenu === "console"} {:else if selectedMenu === "console"}
<GeneralConsole /> <GeneralConsole />
{/if} {/if}
</main> </main>
<style> <style>
main { main {
text-align: left; text-align: left;
padding: 1em; padding: 1em;
max-width: 240px; max-width: 240px;
margin: 0 auto; margin: 0 auto;
} }
@media (min-width: 640px) { @media (min-width: 640px) {
main { main {
max-width: none; max-width: none;
} }
} }
</style> </style>

View File

@@ -1 +1 @@
<h1>Animation creator</h1> <h1>Animation creator</h1>

View File

@@ -1,121 +1,121 @@
<!-- Create a toggle button --> <!-- Create a toggle button -->
<script lang=ts> <script lang=ts>
import { createEventDispatcher, onDestroy } from 'svelte'; import { createEventDispatcher, onDestroy } from 'svelte';
import * as SoftwareVariables from '../stores.js'; import * as SoftwareVariables from '../stores.js';
import Tooltip from './Tooltip.svelte'; import Tooltip from './Tooltip.svelte';
import { _ } from 'svelte-i18n' import { _ } from 'svelte-i18n'
export let icon = "" // The icon wanted export let icon = "" // The icon wanted
export let width = "10em" // The button width export let width = "10em" // The button width
export let height = "5em" // The button height export let height = "5em" // The button height
export let tooltip = "Default tooltip" // The description shown in the tooltip export let tooltip = "Default tooltip" // The description shown in the tooltip
export let checked export let checked
let tooltipMessage = tooltip let tooltipMessage = tooltip
// Import the main colors from the store // Import the main colors from the store
let firstColor, secondColor, thirdColor, fourthColor, okColor, nokColor let firstColor, secondColor, thirdColor, fourthColor, okColor, nokColor
const unsubscribeFirstColor = SoftwareVariables.firstColor.subscribe((value) => (firstColor = value)); const unsubscribeFirstColor = SoftwareVariables.firstColor.subscribe((value) => (firstColor = value));
const unsubscribeSecondColor = SoftwareVariables.secondColor.subscribe((value) => (secondColor = value)); const unsubscribeSecondColor = SoftwareVariables.secondColor.subscribe((value) => (secondColor = value));
const unsubscribeThirdColor = SoftwareVariables.thirdColor.subscribe((value) => (thirdColor = value)); const unsubscribeThirdColor = SoftwareVariables.thirdColor.subscribe((value) => (thirdColor = value));
const unsubscribeFourthColor = SoftwareVariables.fourthColor.subscribe((value) => (fourthColor = value)); const unsubscribeFourthColor = SoftwareVariables.fourthColor.subscribe((value) => (fourthColor = value));
const unsubscribeOkColor = SoftwareVariables.okColor.subscribe((value) => (okColor = value)); const unsubscribeOkColor = SoftwareVariables.okColor.subscribe((value) => (okColor = value));
const unsubscribeNokColor = SoftwareVariables.nokColor.subscribe((value) => (nokColor = value)); const unsubscribeNokColor = SoftwareVariables.nokColor.subscribe((value) => (nokColor = value));
$: cssVarStyles = `--thumb-background:${secondColor};--thumb-background-selected:${thirdColor};--thumb-color:${fourthColor}`; $: cssVarStyles = `--thumb-background:${secondColor};--thumb-background-selected:${thirdColor};--thumb-color:${fourthColor}`;
// Emit a click event when the button is clicked // Emit a click event when the button is clicked
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
function emitClick(event) { function emitClick(event) {
event.preventDefault(); event.preventDefault();
event.target.blur(); event.target.blur();
dispatch('click', event); dispatch('click', event);
} }
// Show a tooltip on mouse hover // Show a tooltip on mouse hover
let tooltipShowing = false let tooltipShowing = false
function toggleTooltip(){ function toggleTooltip(){
tooltipShowing = !tooltipShowing tooltipShowing = !tooltipShowing
} }
// Unsubscribe for all variables used from the store // Unsubscribe for all variables used from the store
onDestroy(() => { onDestroy(() => {
unsubscribeFirstColor(); unsubscribeFirstColor();
unsubscribeSecondColor(); unsubscribeSecondColor();
unsubscribeThirdColor(); unsubscribeThirdColor();
unsubscribeFourthColor(); unsubscribeFourthColor();
unsubscribeOkColor(); unsubscribeOkColor();
unsubscribeNokColor(); unsubscribeNokColor();
}) })
</script> </script>
<div style="{cssVarStyles}"> <div style="{cssVarStyles}">
<Tooltip message={tooltipMessage} show={tooltipShowing}></Tooltip> <Tooltip message={tooltipMessage} show={tooltipShowing}></Tooltip>
<label class="customToggle" <label class="customToggle"
on:mousedown={emitClick} on:mousedown={emitClick}
on:mouseenter={toggleTooltip} on:mouseenter={toggleTooltip}
on:mouseleave={toggleTooltip} on:mouseleave={toggleTooltip}
style="width:{width}; height:{height}; border-radius:{width}; background-color:{fourthColor};"> style="width:{width}; height:{height}; border-radius:{width}; background-color:{fourthColor};">
<input type="checkbox" {checked}> <input type="checkbox" {checked}>
<span class="checkmark" style="width: {height}; height: 100%; border-radius:{height};"> <span class="checkmark" style="width: {height}; height: 100%; border-radius:{height};">
<i class='bx {icon}' style="font-size:{height};"/> <i class='bx {icon}' style="font-size:{height};"/>
</span> </span>
</label> </label>
</div> </div>
<style> <style>
div{ div{
display:inline-block; display:inline-block;
} }
.customToggle { .customToggle {
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
padding: 0.1em; padding: 0.1em;
} }
.customToggle:hover{ .customToggle:hover{
box-shadow: 1px 1px 3px 0px rgba(0, 0, 0, 0.25) inset; box-shadow: 1px 1px 3px 0px rgba(0, 0, 0, 0.25) inset;
} }
.customToggle input[type="checkbox"] { .customToggle input[type="checkbox"] {
opacity: 0; opacity: 0;
position: absolute; /* Position absolue pour garder l'élément dans le flux */ position: absolute; /* Position absolue pour garder l'élément dans le flux */
cursor: pointer; cursor: pointer;
} }
.customToggle input[type="checkbox"]:checked + .checkmark { .customToggle input[type="checkbox"]:checked + .checkmark {
background-color: var(--thumb-background-selected); /* Couleur lorsque la case est cochée */ background-color: var(--thumb-background-selected); /* Couleur lorsque la case est cochée */
float: right; float: right;
animation: checkmark-slide-in 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards; animation: checkmark-slide-in 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
} }
@keyframes checkmark-slide-in { @keyframes checkmark-slide-in {
0% { 0% {
transform: translateX(-50px) scale(1); transform: translateX(-50px) scale(1);
opacity: 1; opacity: 1;
} }
50% { 50% {
transform: translateX(0) scale(1); transform: translateX(0) scale(1);
opacity: 1; opacity: 1;
} }
70% { 70% {
transform: translateX(-5px) scale(1); transform: translateX(-5px) scale(1);
opacity: 1; opacity: 1;
} }
100% { 100% {
transform: translateX(0) scale(1); transform: translateX(0) scale(1);
opacity: 1; opacity: 1;
} }
} }
.checkmark { .checkmark {
text-align:center; text-align:center;
float: left; float: left;
background-color: var(--thumb-background); background-color: var(--thumb-background);
color: var(--thumb-color); color: var(--thumb-color);
transition: opacity 0.3s, transform 0.3s; transition: opacity 0.3s, transform 0.3s;
} }
</style> </style>

View File

@@ -1,69 +1,69 @@
:root{ :root{
-webkit-user-select: none; /* Safari */ -webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */ -ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */ user-select: none; /* Standard syntax */
} }
html, body { html, body {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
body { body {
color: #333; color: #333;
margin: 0; margin: 0;
padding: 8px; padding: 8px;
box-sizing: border-box; box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
} }
a { a {
color: rgb(0,100,200); color: rgb(0,100,200);
text-decoration: none; text-decoration: none;
} }
a:hover { a:hover {
text-decoration: underline; text-decoration: underline;
} }
a:visited { a:visited {
color: rgb(0,80,160); color: rgb(0,80,160);
} }
label { label {
display: block; display: block;
} }
input, button, select, textarea { input, button, select, textarea {
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
-webkit-padding: 0.4em 0; -webkit-padding: 0.4em 0;
padding: 0.4em; padding: 0.4em;
margin: 0 0 0.5em 0; margin: 0 0 0.5em 0;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 2px; border-radius: 2px;
} }
input:disabled { input:disabled {
color: #ccc; color: #ccc;
} }
button { button {
color: #333; color: #333;
background-color: #f4f4f4; background-color: #f4f4f4;
outline: none; outline: none;
} }
button:disabled { button:disabled {
color: #999; color: #999;
} }
button:not(:disabled):active { button:not(:disabled):active {
background-color: #ddd; background-color: #ddd;
} }
button:focus { button:focus {
border-color: #666; border-color: #666;
} }

4
go.mod
View File

@@ -1,6 +1,8 @@
module changeme module changeme
go 1.20 go 1.21
toolchain go1.21.4
require github.com/wailsapp/wails/v2 v2.9.1 require github.com/wailsapp/wails/v2 v2.9.1

2
go.sum
View File

@@ -49,6 +49,7 @@ github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXn
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE= github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4= github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
@@ -90,3 +91,4 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

70
main.go
View File

@@ -1,35 +1,35 @@
package main package main
import ( import (
"embed" "embed"
"github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver" "github.com/wailsapp/wails/v2/pkg/options/assetserver"
) )
//go:embed all:frontend/dist //go:embed all:frontend/dist
var assets embed.FS var assets embed.FS
func main() { func main() {
// Create an instance of the app structure // Create an instance of the app structure
app := NewApp() app := NewApp()
// Create application with options // Create application with options
err := wails.Run(&options.App{ err := wails.Run(&options.App{
Title: "dmxconnect", Title: "dmxconnect",
Width: 1024, Width: 1024,
Height: 768, Height: 768,
AssetServer: &assetserver.Options{ AssetServer: &assetserver.Options{
Assets: assets, Assets: assets,
}, },
OnStartup: app.startup, OnStartup: app.startup,
Bind: []interface{}{ Bind: []interface{}{
app, app,
}, },
}) })
if err != nil { if err != nil {
println("Error:", err.Error()) println("Error:", err.Error())
} }
} }