Skip to content

Commit

Permalink
Merge pull request #5 from jonkerj/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
jonkerj authored Jun 14, 2022
2 parents fb5791a + c80a4a0 commit 064a9ec
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 20 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
name: Release
name: release
on:
push:
branches:
- main
jobs:
release:
name: "Release"
tag:
runs-on: ubuntu-latest
outputs:
changelog: ${{ steps.tag.outputs.changelog }}
tag: ${{ steps.tag.outputs.new_tag }}
version: ${{ steps.tag.outputs.new_version }}
date: ${{ steps.date.outputs.date }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Run gofmt
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
- name: Run vet
run: go vet ./...
uses: actions/checkout@v3
- name: Bump version and tag
id: tag_version
uses: mathieudutour/github-tag[email protected]
uses: mathieudutour/[email protected]
id: tag
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

release:
needs:
- tag
runs-on: ubuntu-latest
steps:
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.tag.outputs.tag }}
name: Release ${{ needs.tag.outputs.version }}
body: |
Changes in this release:
${{ needs.tag.outputs.changelog }}
Docker image: `ghcr.io/${{ github.repository }}:${{ needs.tag.outputs.tag }}`
files: scra-*-*,scra.sha256
49 changes: 49 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: tests
on: pull_request
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: '1.18'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
codeql:
name: analyze
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
build:
name: build test
runs-on: ubuntu-latest
needs:
- golangci
- codeql
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: '1.18'
- name: Run go build
run: |
GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} go build -v
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- revive
101 changes: 101 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.

## Technical

### Code

1. Include [godoc](https://go.dev/blog/godoc) for all exported methods.

2. Make sure it passes the tests in GitHub workflow (your PR gets tested automatically).

### Commits

1. Please use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).

2. Split changes into logical units in seperate commits, explain in the commit body
why the change has been done.

### Pull requests

1. Please branch `develop`, and target your PRs at this branch. When it's time to release,
`develop` gets merged into `main`.

2. Reference any issues covered by your PR.

## Code of Conduct

### Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

### Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

### Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

### Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

### Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Go Industrial I/O!

[![Go Reference](https://pkg.go.dev/badge/github.com/jonkerj/goiio.svg)](https://pkg.go.dev/github.com/jonkerj/goiio)

This a golang client to fetch data from [iiod](https://github.com/analogdevicesinc/libiio).
Please see the [reference](https://pkg.go.dev/github.com/jonkerj/goiio) for documentation.
8 changes: 4 additions & 4 deletions attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type attributeOp struct {
op attributeOperation
}

var attributeOps []attributeOp = []attributeOp{
var attributeOps = []attributeOp{
{name: "raw", op: func(c, v float64) float64 { return v }},
{name: "input", op: func(c, v float64) float64 { return v }},
{name: "offset", op: func(c, v float64) float64 { return c + v }},
Expand All @@ -32,8 +32,8 @@ var attributeOps []attributeOp = []attributeOp{

// GetDevice fetches the first device from the context satisfying the comparison
// function
func (h *Context) GetDevice(comp CompareDevice) *Device {
for _, device := range h.Devices {
func (c *Context) GetDevice(comp CompareDevice) *Device {
for _, device := range c.Devices {
if comp(device) {
return device
}
Expand Down Expand Up @@ -120,7 +120,7 @@ func (c *Channel) GetAttrByName(name string) *ChannelAttribute {
}

func (c *Channel) GetValue() float64 {
var current float64 = 0
var current float64

for _, attrOp := range attributeOps {
a := c.GetAttrByName(attrOp.name)
Expand Down
Loading

0 comments on commit 064a9ec

Please sign in to comment.