Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

NOISSUE- Add Templates and Fix linting #4

Merged
merged 12 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

name: Bug Report
description: File a bug/issue
title: "[BUG] <title>"
labels: ["bug", "needs-review", "needs-reproduction"]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: What were you trying to achieve?
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: What are the expected results?
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: What are the received results?
description: A concise description of what you received.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: What are the steps to reproduce the issue?
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
ianmuchyri marked this conversation as resolved.
Show resolved Hide resolved
validations:
required: false
- type: textarea
attributes:
label: In what environment did you encounter the issue?
description: A concise description of the environment you encountered the issue in.
validations:
required: true
- type: textarea
attributes:
label: Additional information you deem important
description: |
Links? References? Anything that will give us more context about the issue you are encountering!

Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

name: Feature Request
description: File a feature request
title: "[FEATURE] <title>"
labels: ["feature", "needs-review"]
body:
- type: checkboxes
attributes:
label: Is there an existing feature request for this?
description: Please search to see if a request already exists for the feature that you are requesting.
options:
- label: I have searched the existing feature requests
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: Describe the feature you are requesting, as well as the possible use case(s) for it.
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: checkboxes
attributes:
label: Indicate the importance of this feature to you.
description: This will help us prioritize the feature request.
options:
- label: Must-have
required: false
- label: Should-have
required: false
- label: Nice-to-have
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the feature that you are requesting.

Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "gomod"
ianmuchyri marked this conversation as resolved.
Show resolved Hide resolved
directory: "./docker"
ianmuchyri marked this conversation as resolved.
Show resolved Hide resolved
schedule:
interval: "weekly"

- package-ecosystem: "docker"
directory: "/"
ianmuchyri marked this conversation as resolved.
Show resolved Hide resolved
schedule:
interval: "weekly"
64 changes: 64 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!-- Copyright (c) Abstract Machines
SPDX-License-Identifier: Apache-2.0 -->

# What type of PR is this?

<!--

Pull request title should be `AMDM-XXX - description` or `NOISSUE - description` where XXX is ID of issue that this PR relate to.

For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details.

For a timely review/response, please avoid force-pushing additional commits if your PR already received reviews or comments.

- Provide tests for your changes.
- Use descriptive commit messages.
- Comment your code where appropriate.
- Squash your commits
- Update any related documentation.
-->

<!--(check all applicable)-->

- [ ] Refactor
- [ ] Feature
- [ ] Bug Fix
- [ ] Optimization
- [ ] Documentation Update
- [ ] Dependency Update

## What does this do?

<!--
Please provide a brief description of what this PR is intended to do.
Include List any changes that modify/break current functionality.
-->

## Which issue(s) does this PR fix/relate to?

<!--
For pull requests that relate or close an issue, please include them below. We like to follow [Github's guidance on linking issues to pull requests](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).

For example having the text: "Resolves #1234" would connect the current pull request to issue 1234. And when we merge the pull request, Github will automatically close the issue.
-->

- Related Issue #
- Resolves #

## Have you included tests for your changes?

<!--Please confirm the following before submitting your PR, thank you!-->

- [ ] Yes
- [ ] No, and this is why: <!--please replace this line with details on why tests have not been included-->

## Did you document any new/modified functionality?

<!--Please confirm the following before submitting your PR, thank you!-->

- [ ] Yes
- [ ] No, and this is why: <!--please replace this line with details on why documentation has not been included-->

### Notes

<!--Please provide any additional information you feel is important.-->
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

name: Create and publish a Docker image

on:
push:
branches: ["main"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build service and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
build-args: |
SVC=magistrala-ui
tags: ghcr.io/absmach/magistrala-ui:latest
labels: ${{ steps.meta.outputs.labels }}
31 changes: 31 additions & 0 deletions .github/workflows/check-license.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

name: Check License Header

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check-license:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check License Header
run: |
CHECK=$(grep -rcL --exclude-dir={.git,build} \
--exclude=\*.{crt,key,pem,md,csv,mod,sum,png,jpeg,ico,json,prettierrc} \
--exclude=LICENSE \
--regexp "Copyright (c) Abstract Machines" .)
if [ "$CHECK" ]; then
echo "License header check failed. Fix the following files:"
echo "$CHECK"
exit 1
fi
28 changes: 18 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
name: CI
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

name: Continuous Integration

on:
push:
branches: [main]
branches: [ main ]
pull_request:
branches: [main]
branches: [ main ]

jobs:
ci:
name: Continuous Integration
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.21.x
cache-dependency-path: "go.sum"

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install dependencies
ianmuchyri marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-node@v2
Expand All @@ -43,10 +48,13 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --no-config --disable-all --enable gosimple --enable errcheck --enable govet --enable unused --enable goconst --enable godot --timeout 3m

- name: Build
run: go build -v ./...

- name: Build Binaries
run: |
go mod vendor
make all -j $(nproc)

- name: Run tests
run: go test -v --race -covermode=atomic -coverprofile cover.out ./...
run: |
go mod vendor
make test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
Loading