-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3c1aa8d
Showing
24 changed files
with
1,083 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# [Choice] https://github.com/KEINOS/VSCode-Dev-Container-Go/pkgs/container/vscode-dev-container-go | ||
ARG VARIANT="latest" | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Main Stage | ||
# ----------------------------------------------------------------------------- | ||
FROM ghcr.io/keinos/vscode-dev-container-go:${VARIANT} | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# USER root | ||
# RUN apk add --no-cache <your-package-list-here> | ||
|
||
# [Optional] Uncomment this section to go install anything else you need. | ||
# USER vscode | ||
# RUN cd /tmp && go install "<your-package-here>@<version>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/go | ||
{ | ||
"name": "Go Dev", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
// Choices: https://github.com/KEINOS/VSCode-Dev-Container-Go/pkgs/container/vscode-dev-container-go | ||
"VARIANT": "latest" | ||
} | ||
}, | ||
"runArgs": [ | ||
"--rm", | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined" | ||
], | ||
|
||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"go.goroot": "/usr/local/go", | ||
"terminal.integrated.profiles.linux": { | ||
"bash (login)": { | ||
"path": "/bin/bash", | ||
"args": [] | ||
} | ||
} | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"golang.Go" | ||
], | ||
|
||
// 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 mod download", | ||
|
||
// Comment out to connect as root to debug container. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Editor settings | ||
# ----------------------------------------------------------------------------- | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.go] | ||
indent_style = tab | ||
|
||
# Shell-format | ||
[*.sh] | ||
indent_style = space # shfmt -i=4 | ||
indent_size = 4 # shfmt -i=4 | ||
shell_variant = posix # shfmt -ln=posix | ||
binary_next_line = false # disable shfmt -bn | ||
switch_case_indent = true # shfmt -ci | ||
space_redirects = false # disable shfmt -sr | ||
keep_padding = true # shfmt -kp | ||
function_next_line = false # disable shfmt -fn | ||
|
||
[*.{yml,yaml,json}] | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = false | ||
quote_type = single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# ============================================================================= | ||
# Test Container for Vaious Go Versions | ||
# ============================================================================= | ||
# Default version | ||
ARG VARIANT="1.14-alpine" | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Main Stage | ||
# ----------------------------------------------------------------------------- | ||
FROM golang:${VARIANT} | ||
|
||
RUN apk add --no-cache \ | ||
git \ | ||
alpine-sdk \ | ||
build-base | ||
|
||
WORKDIR /workspaces | ||
|
||
ENTRYPOINT go mod download && go test -race ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Security Policy | ||
|
||
## Supported Go Versions | ||
|
||
We run the tests every week scheduled with the below Go versions. | ||
|
||
| Version | Supported | | ||
| :------ | :----------------: | | ||
| 1.14.15+ | :white_check_mark: | | ||
| 1.15.15+ | :white_check_mark: | | ||
| 1.16.8+ | :white_check_mark: | | ||
| 1.17.1+ | :white_check_mark: | | ||
|
||
## Code Scaning | ||
|
||
[![CodeQL](https://github.com/KEINOS/dev-go/actions/workflows/codeQL-analysis.yml/badge.svg)](https://github.com/KEINOS/dev-go/actions/workflows/codeQL-analysis.yml) | ||
|
||
## Security Status | ||
|
||
- Check the current "[Security overview](https://github.com/KEINOS/dev-go/security)" status. | ||
|
||
## Reporting a Vulnerability | ||
|
||
- Please [issue](https://github.com/KEINOS/dev-go/issues) them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# ============================================================================= | ||
# Docker Compose file for testing on Go versions 1.14~1.17 and latest. | ||
# ============================================================================= | ||
# It is recommended to run specifying a specific Go version and not at once. | ||
# | ||
# Since the service `tidy` will update/re-write the "go.mod" file to the latest | ||
# version, during it's process the "go.mod" file will be gone temporarily. Thus, | ||
# it will cause failure in the other container becaue of missing "go.mod" file. | ||
# | ||
# Recommended usage: | ||
# docker-compose --file ./.github/docker-compose.yml run tidy && \ | ||
# docker-compose --file ./.github/docker-compose.yml run 1.14 | ||
# | ||
# NOT recommended to run all tests at once whith "up": | ||
# docker-compose --file ./.github/docker-compose.yml up | ||
version: "3.9" | ||
services: | ||
# Service tidy updates the go.mod to the latest | ||
tidy: | ||
build: | ||
context: .. | ||
dockerfile: ./.github/Dockerfile | ||
args: | ||
VARIANT: 1.14-alpine | ||
volumes: | ||
- ..:/workspaces | ||
entrypoint: [ "./.github/go-mod-tidy.sh" ] | ||
# Service v1_14 runs the tests on Go v1.14 | ||
v1_14: | ||
build: | ||
context: .. | ||
dockerfile: ./.github/Dockerfile | ||
args: | ||
VARIANT: 1.14-alpine | ||
volumes: | ||
- ..:/workspaces | ||
# Service v1_14 runs the tests on Go v1.15 | ||
v1_15: | ||
build: | ||
context: .. | ||
dockerfile: ./.github/Dockerfile | ||
args: | ||
VARIANT: 1.15-alpine | ||
volumes: | ||
- ..:/workspaces | ||
# Service v1_14 runs the tests on Go v1.15 | ||
v1_16: | ||
build: | ||
context: .. | ||
dockerfile: ./.github/Dockerfile | ||
args: | ||
VARIANT: 1.16-alpine | ||
volumes: | ||
- ..:/workspaces | ||
# Service v1_14 runs the tests on Go v1.16 | ||
v1_17: | ||
build: | ||
context: .. | ||
dockerfile: ./.github/Dockerfile | ||
args: | ||
VARIANT: 1.17-alpine | ||
volumes: | ||
- ..:/workspaces | ||
# Service v1_14 runs the tests on latest Go docker image | ||
latest: | ||
build: | ||
context: .. | ||
dockerfile: ./.github/Dockerfile | ||
args: | ||
VARIANT: alpine | ||
volumes: | ||
- ..:/workspaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
# ============================================================================= | ||
# This script updates Go modules to the latest version. | ||
# ============================================================================= | ||
# It will remove the go.mod file and run `go mod tidy` to get the latest moule | ||
# versions. | ||
# Then it will run the tests to make sure the code is still working, and fails | ||
# if any errors are found during the process. | ||
# | ||
# NOTE: This script is aimed to run in the container via docker-compose. | ||
# See "tidy" service: ./docker-compose.yml | ||
# ============================================================================= | ||
|
||
set -eu | ||
|
||
echo '* Backup modules ...' | ||
mv go.mod go.mod.bak | ||
mv go.sum go.sum.bak | ||
|
||
echo '* Create new blank go.mod ...' | ||
< go.mod.bak head -n 4 > go.mod | ||
|
||
echo '* Run go tidy ...' | ||
go mod tidy | ||
|
||
echo '* Run tests ...' | ||
go test ./... && { | ||
echo '* Testing passed. Removing old go.mod file ...' | ||
rm -f go.mod.bak | ||
rm -f go.sum.bak | ||
echo 'Successfully updated modules!' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pull_request_rules: | ||
- name: Automatic merge on approval | ||
conditions: | ||
- author=KEINOS | ||
- base=main | ||
- title~=^Changes | ||
- files=go.mod | ||
- files=go.sum | ||
- "#files=2" | ||
- check-success=Analyze (go) | ||
- check-success=build | ||
- check-success=Unit test (ubuntu-latest) | ||
- check-success=Unit test (macos-latest) | ||
- check-success=Unit test (windows-latest) | ||
- check-success=CodeQL | ||
- check-success=codecov/patch | ||
- check-success=codecov/project | ||
actions: | ||
merge: | ||
method: merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This workflow updates the code coverage of Codecov. | ||
# It runs the unit test and pushes the measured code coverage analysis. | ||
name: "Codecov" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
schedule: | ||
# Runs at 16:40 UTC on day-of-month 1 (Every day-of-month 1 at AM 01:40 JST, my time) | ||
# See: https://crontab.guru/ | ||
- cron: '40 16 1 * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.14' | ||
- name: Run coverage | ||
run: go test -coverprofile=coverage.out -covermode=atomic ./... | ||
- name: Upload coverage to Codecov | ||
run: bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
schedule: | ||
# Runs at 16:30 UTC on day-of-month 1 (Every day-of-month 1 at AM 01:30 JST, my time) | ||
# See: https://crontab.guru/ | ||
- cron: '30 16 1 * *' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'go' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||
# Learn more: | ||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
Oops, something went wrong.