-
-
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.
Signed-off-by: Dave Henderson <[email protected]>
- Loading branch information
1 parent
2a8fb82
commit a2032bc
Showing
20 changed files
with
1,594 additions
and
19 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,23 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "02:00" | ||
timezone: Canada/Eastern | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "02:00" | ||
timezone: Canada/Eastern | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: docker | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "02:00" | ||
timezone: Canada/Eastern | ||
open-pull-requests-limit: 10 |
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,11 @@ | ||
documentation: | ||
- docs/**/* | ||
- '*.md' | ||
|
||
dependencies: | ||
- go.mod | ||
- go.sum | ||
|
||
build: | ||
- .github/workflows/* | ||
- Makefile |
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,18 @@ | ||
name: Build | ||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: ghcr.io/hairyhenderson/gomplate-ci-build:latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: make test | ||
lint: | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: ghcr.io/hairyhenderson/gomplate-ci-build:latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: make ci-lint |
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 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [main] | ||
paths-ignore: | ||
- '**/*.md' | ||
schedule: | ||
- cron: '0 1 * * 2' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Override automatic language detection by changing the below list | ||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] | ||
language: ['go'] | ||
# Learn more... | ||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
with: | ||
# We must fetch at least the immediate parents so that if this is | ||
# a pull request then we can checkout the head. | ||
fetch-depth: 2 | ||
|
||
# If this run was triggered by a pull request event, then checkout | ||
# the head of the pull request instead of the merge commit. | ||
- run: git checkout HEAD^2 | ||
if: ${{ github.event_name == 'pull_request' }} | ||
|
||
# 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 |
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 @@ | ||
name: Docker Build | ||
on: | ||
push: | ||
|
||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-20.04 | ||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- '5000:5000' | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_CLI_EXPERIMENTAL: enabled | ||
IMG_NAME: henet-ipupdater | ||
steps: | ||
- name: enable experimental mode | ||
run: | | ||
mkdir -p ~/.docker | ||
echo '{"experimental": "enabled"}' > ~/.docker/config.json | ||
- uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/[email protected] | ||
with: | ||
version: v0.5.1 | ||
driver-opts: | | ||
image=moby/buildkit:buildx-stable-1 | ||
network=host | ||
- name: Available platforms | ||
run: echo ${{ steps.buildx.outputs.platforms }} | ||
- name: determine if this is a tag | ||
run: | | ||
if (git describe --abbrev=0 --exact-match &>/dev/null); then | ||
tag=$(git describe --abbrev=0 --exact-match) | ||
echo "is_tag=true" >> $GITHUB_ENV | ||
echo "git_tag=$tag" >> $GITHUB_ENV | ||
# splits the major version from $tag - assumes it's a 3-part semver | ||
echo "major_version=${tag%%\.*}" >> $GITHUB_ENV | ||
fi | ||
if: github.repository == 'hairyhenderson/henet-ipupdater' | ||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
username: hairyhenderson | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
if: github.repository == 'hairyhenderson/henet-ipupdater' && (github.ref == 'refs/heads/main' || env.is_tag == 'true') | ||
- name: Build & Push (non-main branch) | ||
run: | | ||
set -ex | ||
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=localhost:5000/${IMG_NAME} BUILDX_ACTION=--push | ||
docker buildx imagetools create --dry-run -t localhost:5000/${IMG_NAME}:dev localhost:5000/${IMG_NAME}:latest | ||
docker buildx imagetools create --dry-run -t localhost:5000/${IMG_NAME}:dev-alpine localhost:5000/${IMG_NAME}:alpine | ||
if: github.repository != 'hairyhenderson/henet-ipupdater' || github.ref != 'refs/heads/main' | ||
- name: Build & Push (main branch) | ||
run: | | ||
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=hairyhenderson/${IMG_NAME} BUILDX_ACTION=--push | ||
if: github.repository == 'hairyhenderson/henet-ipupdater' && github.ref == 'refs/heads/main' | ||
- name: Build & Push (tagged release) | ||
run: | | ||
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=hairyhenderson/${IMG_NAME} BUILDX_ACTION=--push | ||
set -x | ||
docker buildx imagetools create -t hairyhenderson/${IMG_NAME}:${git_tag} hairyhenderson/${IMG_NAME}:latest | ||
docker buildx imagetools create -t hairyhenderson/${IMG_NAME}:${major_version} hairyhenderson/${IMG_NAME}:latest | ||
docker buildx imagetools create -t hairyhenderson/${IMG_NAME}:${git_tag}-alpine hairyhenderson/${IMG_NAME}:alpine | ||
docker buildx imagetools create -t hairyhenderson/${IMG_NAME}:${major_version}-alpine hairyhenderson/${IMG_NAME}:alpine | ||
if: github.repository == 'hairyhenderson/henet-ipupdater' && env.is_tag == 'true' |
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,11 @@ | ||
name: Labeler | ||
on: | ||
pull_request_target: | ||
|
||
jobs: | ||
label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/labeler@v3 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" |
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,2 @@ | ||
ipupdater | ||
bin/ |
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,73 @@ | ||
linters-settings: | ||
govet: | ||
check-shadowing: true | ||
enable: | ||
- fieldalignment | ||
golint: | ||
min-confidence: 0 | ||
gocyclo: | ||
min-complexity: 10 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 4 | ||
lll: | ||
line-length: 140 | ||
nolintlint: | ||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- deadcode | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exhaustive | ||
- exportloopref | ||
- funlen | ||
- gci | ||
# - gochecknoglobals | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godox | ||
- gofmt | ||
- gofumpt | ||
- goheader | ||
- goimports | ||
# - gomnd | ||
- gomodguard | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nlreturn | ||
- noctx | ||
- nolintlint | ||
- prealloc | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- staticcheck | ||
- structcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- varcheck | ||
- whitespace | ||
- wsl |
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,67 @@ | ||
# syntax=docker/dockerfile:1.2.1-labs | ||
FROM --platform=linux/amd64 golang:1.17.2-alpine AS build | ||
|
||
ARG PKG_NAME | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH | ||
|
||
RUN apk add --no-cache make git | ||
|
||
WORKDIR /src | ||
COPY go.mod ./ | ||
COPY go.sum ./ | ||
|
||
RUN --mount=type=cache,id=go-build-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},target=/root/.cache/go-build \ | ||
--mount=type=cache,id=go-pkg-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},target=/go/pkg \ | ||
go mod download -x | ||
|
||
COPY . ./ | ||
|
||
RUN --mount=type=cache,id=go-build-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},target=/root/.cache/go-build \ | ||
--mount=type=cache,id=go-pkg-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},target=/go/pkg \ | ||
make build | ||
RUN mv bin/${PKG_NAME}* /bin/ | ||
|
||
FROM scratch AS release-linux | ||
|
||
ARG PKG_NAME | ||
ARG VCS_REF | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
LABEL org.opencontainers.image.revision=$VCS_REF \ | ||
org.opencontainers.image.source="https://github.com/hairyhenderson/${PKG_NAME}" | ||
|
||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=build /bin/${PKG_NAME}_${TARGETOS}-${TARGETARCH}${TARGETVARIANT} /${PKG_NAME} | ||
|
||
ENTRYPOINT [ "/ipupdater" ] | ||
|
||
FROM alpine:3.14.2 AS alpine | ||
|
||
ARG PKG_NAME | ||
ARG VCS_REF | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
LABEL org.opencontainers.image.revision=$VCS_REF \ | ||
org.opencontainers.image.source="https://github.com/hairyhenderson/${PKG_NAME}" | ||
|
||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=build /bin/${PKG_NAME}_${TARGETOS}-${TARGETARCH}${TARGETVARIANT} /${PKG_NAME} | ||
|
||
ENTRYPOINT [ "/ipupdater" ] | ||
|
||
FROM --platform=windows/amd64 mcr.microsoft.com/windows/nanoserver:2009 AS release-windows | ||
|
||
ARG PKG_NAME | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
COPY --from=build /bin/${PKG_NAME}_${TARGETOS}-${TARGETARCH}${TARGETVARIANT}.exe /${PKG_NAME}.exe | ||
|
||
FROM release-$TARGETOS AS release |
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016,2021 Dave Henderson | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.