-
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
shanedabes
committed
Nov 14, 2021
1 parent
4f34814
commit c83b753
Showing
22 changed files
with
693 additions
and
1 deletion.
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,5 @@ | ||
{ | ||
"extends": [ | ||
"config:base" | ||
] | ||
} |
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,166 @@ | ||
--- | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '*.go' | ||
- Dockerfile | ||
- go.mod | ||
- go.sum | ||
pull_request: | ||
paths: | ||
- '*.go' | ||
- Dockerfile | ||
- go.mod | ||
- go.sum | ||
|
||
jobs: | ||
hadolint: | ||
name: Run hadolint | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: hadolint | ||
uses: reviewdog/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
reporter: github-pr-review | ||
filter_mode: diff_context | ||
fail_on_error: true | ||
|
||
gotest: | ||
name: Go test | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
|
||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-20.04 | ||
needs: | ||
- hadolint | ||
- gotest | ||
if: "!contains(github.event.head_commit.message, '[ci-skip]')" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: '5.x' | ||
|
||
- name: GitVersion | ||
id: gitversion | ||
uses: gittools/actions/gitversion/[email protected] | ||
|
||
- name: Prepare | ||
id: prep | ||
run: | | ||
if test -f "./goss.yaml"; then | ||
echo ::set-output name=goss::true | ||
else | ||
echo ::set-output name=goss::false | ||
fi | ||
if [ "${{github.event_name}}" == "pull_request" ]; then | ||
echo ::set-output name=push::false | ||
echo ::set-output name=cache_from::"type=local,src=/tmp/.buildx-cache" | ||
echo ::set-output name=cache_to::"" | ||
else | ||
echo ::set-output name=push::true | ||
echo ::set-output name=cache_from::"type=local,src=/tmp/.buildx-cache" | ||
echo ::set-output name=cache_to::"type=local,dest=/tmp/.buildx-cache,mode=max" | ||
fi | ||
echo ::set-output name=gitversionf::${GITVERSION_FULLSEMVER/+/-} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: amd64,arm64 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v1 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Install and configure Buildx | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
install: true | ||
version: latest | ||
driver-opts: image=moby/buildkit:latest | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: docker-cache | ||
restore-keys: docker-cache | ||
|
||
# Install the GOSS testing framework | ||
- name: Set up goss/dgoss | ||
uses: e1himself/[email protected] | ||
if: ${{ steps.prep.outputs.goss == 'true' }} | ||
with: | ||
version: 'v0.3.16' | ||
|
||
# Creates a local build to run tests on | ||
- name: Build and Load local test-container | ||
if: ${{ steps.prep.outputs.goss == 'true' }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
load: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:test | ||
cache-from: ${{ steps.prep.outputs.cache_from }} | ||
cache-to: ${{ steps.prep.outputs.cache_to }} | ||
|
||
# Run GOSS tests if included with the container | ||
- name: Run GOSS tests | ||
if: ${{ steps.prep.outputs.goss == 'true' }} | ||
env: | ||
GOSS_FILE: ./goss.yaml | ||
run: | | ||
dgoss run ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:test | ||
# Push if not a PR, otherwise just test the build process for all requested platforms | ||
- name: Build and Push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
file: ./Dockerfile | ||
push: ${{ steps.prep.outputs.push }} | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/gowon-retroachievements:latest | ||
ghcr.io/${{ github.repository_owner }}/gowon-retroachievements:${{ steps.prep.outputs.gitversionf }} | ||
cache-from: ${{ steps.prep.outputs.cache_from }} | ||
cache-to: ${{ steps.prep.outputs.cache_to }} |
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 @@ | ||
kv.db |
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 @@ | ||
FROM golang:alpine as build-env | ||
COPY . /src | ||
WORKDIR /src | ||
RUN go build -o gowon-retroachievements | ||
|
||
FROM alpine:3.14.2 | ||
RUN mkdir /data | ||
ENV GOWON_RA_KV_PATH /data/kv.db | ||
WORKDIR /app | ||
COPY --from=build-env /src/gowon-retroachievements /app/ | ||
ENTRYPOINT ["./gowon-retroachievements"] |
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 |
---|---|---|
@@ -1 +1 @@ | ||
# gowon-retroachievements | ||
# gowon-retroachievements |
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,9 @@ | ||
# Bot demo | ||
|
||
These files can be used to setup a test instance for demo or testing purposes using skaffold. | ||
|
||
To run an ircd and bot instance in a kubernetes cluster (like k3d) cd to this directory and run: | ||
|
||
skaffold dev --tail | ||
|
||
An [tiny](https://github.com/osa1/tiny) deployment is included. To use it run `tiny.sh`. |
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 @@ | ||
deploy-retroachievements.yaml |
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,10 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: mosquitto-config | ||
data: | ||
mosquitto.conf: | | ||
listener 1883 | ||
protocol mqtt | ||
allow_anonymous 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,26 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: tiny-config | ||
data: | ||
tiny.yml: | | ||
--- | ||
servers: | ||
- addr: oragono | ||
port: 6667 | ||
tls: false | ||
realname: tester | ||
nicks: | ||
- tester | ||
join: | ||
- '#gowon' | ||
defaults: | ||
nicks: | ||
- tester | ||
realname: tester | ||
join: [] | ||
tls: false |
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,30 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: gowon | ||
labels: | ||
app.kubernetes.io/name: gowon | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: gowon | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: gowon | ||
spec: | ||
containers: | ||
- name: gowon | ||
image: ghcr.io/gowon-irc/gowon:0.1.0-66 | ||
env: | ||
- name: GOWON_SERVER | ||
value: oragono:6667 | ||
- name: GOWON_BROKER | ||
value: mosquitto:1883 | ||
- name: GOWON_NICK | ||
value: gowon | ||
- name: GOWON_USER | ||
value: gowon | ||
- name: GOWON_CHANNELS | ||
value: "#gowon" |
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,22 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: oragono | ||
labels: | ||
app.kubernetes.io/name: oragono | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: oragono | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: oragono | ||
spec: | ||
containers: | ||
- name: oragono | ||
image: oragono/oragono | ||
ports: | ||
- containerPort: 6667 | ||
name: ircd |
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,30 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: mosquitto | ||
labels: | ||
app.kubernetes.io/name: mosquitto | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: mosquitto | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: mosquitto | ||
spec: | ||
containers: | ||
- name: mosquitto | ||
image: eclipse-mosquitto | ||
ports: | ||
- containerPort: 1883 | ||
name: mqtt | ||
volumeMounts: | ||
- name: mosquitto-config | ||
mountPath: /mosquitto/config/mosquitto.conf | ||
subPath: mosquitto.conf | ||
volumes: | ||
- name: mosquitto-config | ||
configMap: | ||
name: mosquitto-config |
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,27 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: tiny | ||
labels: | ||
app.kubernetes.io/name: tiny | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: tiny | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: tiny | ||
spec: | ||
containers: | ||
- name: tiny | ||
image: ghcr.io/shanedabes/tiny:v0.9.0 | ||
volumeMounts: | ||
- name: tiny-config | ||
mountPath: /tiny.yml | ||
subPath: tiny.yml | ||
volumes: | ||
- name: tiny-config | ||
configMap: | ||
name: tiny-config |
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,12 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: oragono | ||
spec: | ||
ports: | ||
- name: ircd | ||
port: 6667 | ||
targetPort: ircd | ||
selector: | ||
app.kubernetes.io/name: oragono |
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,12 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mosquitto | ||
spec: | ||
ports: | ||
- name: mqtt | ||
port: 1883 | ||
targetPort: mqtt | ||
selector: | ||
app.kubernetes.io/name: mosquitto |
Oops, something went wrong.