Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisreddington committed Nov 14, 2024
0 parents commit 1e635aa
Show file tree
Hide file tree
Showing 48 changed files with 5,735 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm",
"customizations": {
"vscode": {
"extensions": [
"GitHub.codespaces",
"github.vscode-github-actions",
"GitHub.copilot",
"GitHub.copilot-chat",
"github.copilot-workspace",
"GitHub.vscode-pull-request-github",
"GitHub.remotehub",
"GitHub.vscode-codeql",
"golang.Go"
]
}
},
"tasks": {
"build": "go build .",
"test": "go test ./...",
"run": "go run ."
},

// Features to add to the dev container. More info: https://containers.dev/features.

"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
17 changes: 17 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Core Requirements

- The end goal is to generate an STL file. Other types can be used for intermediate steps for accuracy (and is encouraged), but the final output should be in float32 to adhere to the STL format.

## Code Quality Requirements

- Follow standard Go conventions and best practices
- Use clear, descriptive variable and function names
- Add comments to explain complex logic or non-obvious implementations
- Include GoDoc comments for all:
- Packages
- Functions and methods
- Types and interfaces
- Exported variables and constants
- Write unit tests for core functionality
- Keep functions focused and manageable (generally under 50 lines)
- Use error handling patterns consistently
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
allow:
- dependency-type: "direct"
- dependency-type: "indirect"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
28 changes: 28 additions & 0 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
run:
# Allow multiple directories to be analyzed
allow-parallel-runners: true

# Add modules-download-mode
modules-download-mode: readonly

# Allow multiple packages
allow-separate-packages: true

# Configure specific linters
linters:
enable:
- gofmt
- govet
- revive
- staticcheck

issues:
exclude-use-default: false

# Include all subdirectories
exclude-dirs-use-default:
false

# If needed, explicitly specify which directories to analyze
exclude-dirs:
- vendor
18 changes: 18 additions & 0 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate Repository Configuration

permissions:
contents: read

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

jobs:
validate:
name: Validate Baseline Configuration
uses: chrisreddington/reusable-workflows/.github/workflows/baseline-validator.yml@main
with:
required-features: "ghcr.io/devcontainers/features/github-cli:1"
56 changes: 56 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# .github/workflows/build.yml
name: Build

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

permissions:
contents: read
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

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

- name: Test with Coverage
run: |
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
go tool cover -func=coverage.out > coverage.txt
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage.html
coverage.txt
- name: Post Coverage Comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const coverage = fs.readFileSync('coverage.txt', 'utf8');
const comment = `### Code Coverage Report\n\`\`\`\n${coverage}\`\`\``;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});
42 changes: 42 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Lint Code Base

permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

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

jobs:
lint:
name: Lint Code Base
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"

- name: Run Super-Linter
uses: super-linter/super-linter/slim@v7
env:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: "main"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_GO: false
VALIDATE_JSCPD: false
VALIDATE_JSON: false
VALIDATE_JSON_PRETTIER: false
LINTER_RULES_PATH: .github/linters
GOLANGCI_LINT_CONFIG: .golangci.yml
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
attestations: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cli/gh-extension-precompile@v2
with:
generate_attestations: true
go_version_file: go.mod
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/gh-skyline
*.stl
.DS_STORE

coverage.txt
coverage.html

node_modules

# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
.env
5 changes: 5 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# For more information, see [docs](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax)

# This repository is maintained by:

* @chrisreddington @leereilly @martinwoodward
92 changes: 92 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Contributing

[fork]: https://github.com/github/REPO/fork
[pr]: https://github.com/github/REPO/compare
[style]: https://github.com/github/REPO/blob/main/.golangci.yaml

Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.

Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).

Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

## Prerequisites for running and testing code

### GitHub Codespace

The repository includes a [pre-configured devcontainer](.devcontainer/devcontainer.json) that handles most prerequisites. To use it:

1. Create a fork of the repository
1. Click the green "Code" button on the repository
1. Select the "Codespaces" tab
1. Click "Create Codespace on main" (or on the branch you want to work on)

This will create a cloud-based development environment with:

- Go installation
- Required development tools
- Project dependencies
- GitHub CLI (gh)
- Several Visual Studio Code extensions for Go development and GitHub integration
- Pre-configured linting and testing tools

The environment will be ready to use in a few minutes.

### Local development environment

These are one time installations required to be able to test your changes locally as part of the pull request (PR) submission process.

1. install Go [through download](https://go.dev/doc/install) | [through Homebrew](https://formulae.brew.sh/formula/go)
1. [install golangci-lint](https://golangci-lint.run/usage/install/#local-installation)

### Building the extension

You can build from source using the following command:

```bash
go build -o gh-skyline
```

However, you'll want to test your changes in the GitHub CLI before you raise a Pull Request. To make that easier in local development, you could consider using the provided [rebuild script](rebuild.sh):

```bash
./rebuild.sh
```

This script will:

1. Remove any existing installation of the `gh-skyline` extension
2. Build the extension from source
3. Install the local version for testing

### Testing

Run the full test suite with:

```bash
go test ./...
```

## Submitting a pull request

1. [Fork][fork] and clone the repository
1. Configure and install the dependencies: `script/bootstrap`
1. Make sure the tests pass on your machine: `go test -v ./...`
1. Make sure linter passes on your machine: `golangci-lint run`
1. Create a new branch: `git checkout -b my-branch-name`
1. Make your change, add tests, and make sure the tests and linter still pass
1. Push to your fork and [submit a pull request][pr]
1. Pat yourself on the back and wait for your pull request to be reviewed and merged.

Here are a few things you can do that will increase the likelihood of your pull request being accepted:

- Follow the [style guide][style].
- Write tests.
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).

## Resources

- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
- [GitHub Help](https://help.github.com)
Loading

0 comments on commit 1e635aa

Please sign in to comment.