Skip to content

Commit

Permalink
feat: Init the project
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Jul 27, 2021
1 parent caec11f commit 47ddf02
Show file tree
Hide file tree
Showing 17 changed files with 482 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Bug Report
about: Create a bug report to help us improve this project
title: "[Main title for your issue here]"
labels: bug
assignees: smutel
---
<!-- Verify first that your issue is not already reported on GitHub -->
<!-- Ensure that the latest release is affected by this bug -->
<!-- Complete most of sections below as described -->

## Summary
<!-- Describe here with one sentence the bug encountered -->

## Version

### Netbox version
<!-- Enter below the version of netbox -->
```paste below
```

### go-netbox version
<!-- Enter below the version of go-netbox -->
```paste below
```

## Issue details

### Piece of code using go-netbox wich is not working
<!-- Put here your code where you call go-netbox wich are not working -->

### Affected library call
<!-- Give the name of function or API call affected by this bug -->

### Program output
<!-- Copy-paste the program output (only the error) -->
```paste below
```

## Behaviors

### Actual Behavior
<!-- Describe below the actual behavior -->

### Expected Behavior
<!-- Describe below the expected behavior -->
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: New feature
about: Need a new feature not yet implemented
title: "[Main title for your issue here]"
labels: enhancement
assignees: smutel
---
<!-- Verify first that this feature is not already implemented in the master branch -->
<!-- Complete most of sections below as described -->

## Summary
<!-- Describe here with one sentence what the new feature or the enhancement is -->

## Example
<!-- Example of code using this new feature -->

## Usage
<!-- Describe here a use case for this new feature/enhancement -->
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Help Needed
about: I need some help to use this project
title: "[I am not able to do ...]"
labels: help wanted
assignees: smutel
---
<!--- Verify first that your read the README and documentation before -->
<!--- Complete most of sections below as described -->

## Issue description

### What I want to do
<!--- Describe here what you want to do -->

### What I already test
<!-- Please list the tasks you did to try to do what you want, for example -->
1. `Read the README`

### Other important information

## Version

### Netbox version
<!--- Enter below the version of netbox -->
```paste below
```

### go-netbox version
<!-- Enter below the version of go-netbox -->
```paste below
```
18 changes: 18 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: true

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- smutel

# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- wip
- draft

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0
62 changes: 62 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Master

on:
push:
branches:
- master

jobs:
Build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/[email protected]

- name: Unshallow
run: git fetch --prune --unshallow

- name: Lint
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.github_token }}
golangci_lint_flags: "--config=.golangci.yml"

- name: Setup env
run: |
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
mkdir -p "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel"
ln -sf "$GITHUB_WORKSPACE/" "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel/go-netbox"
shell: bash

- name: Swagger and patchs
run: |
NETBOX_MAJOR_VERSION=$(cat netbox_major_version)
echo "NETBOX_MAJOR_VERSION=${NETBOX_MAJOR_VERSION}"
LAST_NETBOX_VERSION="$(./utils/netbox_get_last_version ${NETBOX_MAJOR_VERSION})"
echo "LAST_NETBOX_VERSION=${LAST_NETBOX_VERSION}"
export VERSION=${LAST_NETBOX_VERSION}
git clone https://github.com/netbox-community/netbox-docker.git
cd netbox-docker
mv docker-compose.override.yml.example docker-compose.override.yml
docker-compose up -d
cd ..
while ! curl -s http://127.0.0.1:8000/api/swagger.json -o swagger.json 2> /dev/null; do sleep 1; done
curl -sL https://github.com/go-swagger/go-swagger/releases/download/v0.27.0/swagger_linux_amd64 -o swagger
chmod 755 swagger
rm -rf netbox && mkdir netbox && touch netbox/.gitkeep
./swagger generate client -f swagger.json -A go-netbox -t "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel/go-netbox/netbox" --copyright-file="$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel/go-netbox/LICENSE"
find patchs -type f -name "*.patch" | xargs patch -p0
shell: bash

- name: Commit library
uses: EndBug/add-and-commit@v7
with:
add: 'netbox'
author_name: smutel
default_author: github_actor
message: 'ci: Autogeneration of go-netbox library'
pull_strategy: '--rebase'
54 changes: 54 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: PR

on:
pull_request:

jobs:
Build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Check conventional commits in PR
uses: Namchee/[email protected]
with:
access_token: ${{ secrets.github_token }}
label: "no-conventional-commits"
close: false
template: "Thank you for your contribution attempt in this repository!\n\nUnfortunately, this pull request doesn't meet our standards by reason we stated below.\nFor future pull requests, please use conventional commits.\nPlease update the commits in this PR with conventional commits rules."
strict: false

- name: Checkout
uses: actions/[email protected]

- name: Unshallow
run: git fetch --prune --unshallow

- name: Setup env
run: |
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
mkdir -p "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel"
ln -sf "$GITHUB_WORKSPACE/" "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel/go-netbox"
shell: bash

- name: Swagger and patchs
run: |
NETBOX_MAJOR_VERSION=$(cat netbox_major_version)
echo "NETBOX_MAJOR_VERSION=${NETBOX_MAJOR_VERSION}"
LAST_NETBOX_VERSION="$(./utils/netbox_get_last_version ${NETBOX_MAJOR_VERSION})"
echo "LAST_NETBOX_VERSION=${LAST_NETBOX_VERSION}"
export VERSION=${LAST_NETBOX_VERSION}
git clone https://github.com/netbox-community/netbox-docker.git
cd netbox-docker
mv docker-compose.override.yml.example docker-compose.override.yml
docker-compose up -d
cd ..
while ! curl -s http://127.0.0.1:8000/api/swagger.json -o swagger.json 2> /dev/null; do sleep 1; done
curl -sL https://github.com/go-swagger/go-swagger/releases/download/v0.27.0/swagger_linux_amd64 -o swagger
chmod 755 swagger
rm -rf netbox && mkdir netbox && touch netbox/.gitkeep
./swagger generate client -f swagger.json -A go-netbox -t "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel/go-netbox/netbox"
find patchs -type f -name "*.patch" | xargs patch -p0
shell: bash
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Release

on:
push:
tags:
- "v*"

jobs:
Release:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/[email protected]

- name: Unshallow
run: git fetch --prune --unshallow

- name: Import GPG key
id: import_gpg
uses: crazy-max/[email protected]
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}

- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1

- name: Generate CHANGELOG for this version
run: ./utils/getChangelogRelease CHANGELOG.md ${{ steps.tag.outputs.tag }} > /tmp/RELEASE_CHANGELOG.md

- name: Release
uses: actions/create-release@v1
with:
draft: true
prerelease: false
release_name: ${{ steps.tag.outputs.tag }}
tag_name: ${{ github.ref }}
body_path: /tmp/RELEASE_CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) 2020 Samuel Mutel <[email protected]>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8 changes: 8 additions & 0 deletions NOTE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
git clone https://github.com/netbox-community/netbox-docker.git
mv docker-compose.override.yml.example docker-compose.override.yml
docker-compose up
curl http://127.0.0.1:8000/api/swagger.json -o swagger.json
curl -L https://github.com/go-swagger/go-swagger/releases/download/v0.27.0/swagger_linux_amd64 -o swagger
chmod 755 swagger
mkdir -p ~/go/src/github.com/smutel/go-netbox
./swagger generate client -f swagger.json -A go-netbox --with-flatten=full -t ~/go/src/github.com/smutel/go-netbox
Loading

0 comments on commit 47ddf02

Please sign in to comment.