Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ go mod download
# See https://docs.github.com/en/codespaces/managing-your-codespaces/managing-gpg-verification-for-github-codespaces
git config --global commit.gpgsign false

make build

make test || echo "tests failed, there may be an issue with this dev container. contribute with care"
go build ./...
50 changes: 15 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,63 @@ on:
- main
paths-ignore:
- 'README.md'
- 'docs/*.md'
pull_request:
paths-ignore:
- 'README.md'
- 'docs/*.md'

permissions:
contents: read
packages: write

jobs:
lint:
name: golangci-lint
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Go
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11.4
- name: go vet
run: go vet ./...
- name: gofmt
run: test -z "$(gofmt -l .)"

test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, ubuntu-24.04-arm]
name: test
os: [ubuntu-latest, windows-latest]
name: build
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v7
- uses: actions/checkout@v7
- name: Install Go
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
- name: go build
run: go build ./...
- name: go test
run: go test ./... -race
- name: go test (compile)
run: go test ./...

container:
name: container-build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7

- uses: actions/checkout@v7
- name: Install Go
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"

- name: Install ko
run: go install github.com/google/ko@v0.18.1

- name: Set build metadata
id: meta
shell: bash
run: |
short_sha="${GITHUB_SHA::7}"
version="${GITHUB_REF_NAME}-${short_sha}"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"

- name: Build container image (ko)
env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/gonetsim
VERSION: ${{ steps.meta.outputs.version }}
REVISION: ${{ github.sha }}
BUILD_DATE: ${{ steps.meta.outputs.build_date }}
shell: bash
run: |
ko build \
--bare \
--platform=linux/amd64,linux/arm64 \
--push=false \
--image-user=0:0 \
--tags=main,latest,sha-${GITHUB_SHA} \
.
ko build --bare --platform=linux/amd64,linux/arm64 --push=false .
20 changes: 1 addition & 19 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:

permissions:
contents: write
packages: write
id-token: write
attestations: write


jobs:
release:
Expand All @@ -25,24 +21,10 @@ jobs:
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
- name: Install ko
run: go install github.com/google/ko@v0.18.1
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download Syft
uses: anchore/sbom-action/download-syft@v0
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# After GoReleaser runs, attest all the files in ./dist/checksums.txt:
- uses: actions/attest@v4
with:
subject-checksums: ./dist/checksums.txt
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# 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~
Expand Down Expand Up @@ -39,5 +36,8 @@ dist/
gonetsim
bin/

# listener capture output
artifacts/
# runtime output
tls/
*.pcapng
*.keylog
*.log
13 changes: 13 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "2"

linters:
default: none
enable:
- govet
- ineffassign
- staticcheck
- misspell

formatters:
enable:
- gofmt
95 changes: 38 additions & 57 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
# This is an example .goreleaser.yaml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

project_name: GoNetSim
version: 2

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- id: gonetsim
main: .
main: ./cmd/gonetsim
env:
- CGO_ENABLED=0
goos:
- linux
- windows
# - darwin
- darwin
ldflags:
- -s -w
- -X github.com/lachlanharrisdev/gonetsim/cmd.Version={{.Version}}
Expand All @@ -33,15 +22,13 @@ builds:

archives:
- formats: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
formats: zip
Expand All @@ -50,52 +37,46 @@ checksum:
name_template: "checksums.txt"

changelog:
use: github
abbrev: 7
groups:
- title: "Features"
regexp: '^feat(\(.+\))?:'
order: 0
- title: "Bug Fixes"
regexp: '^fix(\(.+\))?:'
order: 1
- title: "Uncategorized"
order: 999
filters:
exclude:
- '^docs(\(.+\))?:'
- '^test(\(.+\))?:'
- '^refactor(\(.+\))?:'
- '^chore(\(.+\))?:'
- '^refc(\(.+\))?:'
use: github
abbrev: 7
groups:
- title: "Features"
regexp: '^feat(\(.+\))?:'
order: 0
- title: "Bug Fixes"
regexp: '^fix(\(.+\))?:'
order: 1
- title: "Uncategorized"
order: 999
filters:
exclude:
- '^docs(\(.+\))?:'
- '^test(\(.+\))?:'
- '^refactor(\(.+\))?:'
- '^chore(\(.+\))?:'

release:
github:
owner: lachlanharrisdev
name: gonetsim
draft: false
replace_existing_draft: false
use_existing_draft: false
replace_existing_artifacts: false

name_template: "{{ .Tag }}"
header: |
# GoNetSim {{ .Version }}

**Release Date:** {{ .Date }}
**Latest Included Commit:** {{ .ShortCommit }}
**Download URL:** {{ .ReleaseURL }}
github:
owner: lachlanharrisdev
name: gonetsim
draft: false
replace_existing_draft: false
use_existing_draft: false
replace_existing_artifacts: false

---
footer: |
---
name_template: "{{ .Tag }}"
header: |
# GoNetSim {{ .Version }}

## Installation
**Release Date:** {{ .Date }}
**Latest Included Commit:** {{ .ShortCommit }}
**Download URL:** {{ .ReleaseURL }}

Please refer to the [Installation Guide](https://gonetsim.lachlanharris.au/guides/installation)
---
footer: |
---

### Resources
## Resources

- [Documentation](https://gonetsim.lachlanharris.au/)
- [Report Issues](https://github.com/{{ .Env.GITHUB_REPOSITORY }}/issues)
- [Discussions](https://github.com/{{ .Env.GITHUB_REPOSITORY }}/discussions)
- [Documentation](https://gonetsim.lachlanharris.au/)
- [Report Issues](https://github.com/{{ .Env.GITHUB_REPOSITORY }}/issues)
4 changes: 2 additions & 2 deletions .ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaultPlatforms:
builds:
- id: gonetsim
dir: .
main: .
main: ./cmd/gonetsim
env:
- CGO_ENABLED=0
flags:
Expand All @@ -17,4 +17,4 @@ builds:
- -w
- -X github.com/lachlanharrisdev/gonetsim/cmd.Version={{.Env.VERSION}}
- -X github.com/lachlanharrisdev/gonetsim/cmd.Revision={{.Env.REVISION}}
- -X github.com/lachlanharrisdev/gonetsim/cmd.Date={{.Env.BUILD_DATE}}
- -X github.com/lachlanharrisdev/gonetsim/cmd.Date={{.Env.BUILD_DATE}}
17 changes: 0 additions & 17 deletions CITATION.cff

This file was deleted.

Loading