Skip to content

Commit c34033e

Browse files
authored
Merge branch 'main' into fix/persistence
2 parents 4d0afd8 + dfeb89c commit c34033e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1491
-9388
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.cache/
22
.git/
33
.vscode/
4-
docs/
54
node_modules/
65
tests/

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.parcel-cache/
22
.vscode/
33
build/
4-
docs/.vuepress/dist/
54
node_modules/

.github/workflows/main.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@ name: CI
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
tags:
77
- '*.*.*' # semver, will override latest
88
- '*-preview' # preview, won't override latest
99
pull_request:
1010
branches:
11-
- master
11+
- main
1212
workflow_dispatch: # Allow manual trigger
1313

14+
permissions:
15+
contents: write
16+
packages: write
17+
1418
jobs:
1519
lint:
1620
runs-on: ubuntu-latest
21+
timeout-minutes: 5
1722
steps:
1823
- uses: actions/checkout@v4
1924

20-
- id: nvm
21-
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
22-
23-
- uses: actions/setup-node@v3
25+
- uses: actions/setup-node@v4
2426
with:
25-
node-version: '${{ steps.nvm.outputs.NVMRC }}'
27+
node-version-file: .nvmrc
2628
cache: yarn
2729

2830
- run: yarn install --frozen-lockfile
@@ -34,23 +36,22 @@ jobs:
3436
3537
test:
3638
runs-on: ubuntu-latest
39+
timeout-minutes: 5
3740
steps:
3841
- uses: actions/checkout@v4
3942
with:
4043
fetch-depth: 0
4144

42-
- id: nvm
43-
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
44-
45-
- uses: actions/setup-node@v3
45+
- uses: actions/setup-node@v4
4646
with:
47-
node-version: '${{ steps.nvm.outputs.NVMRC }}'
47+
node-version-file: .nvmrc
4848
cache: yarn
4949

50+
5051
- name: Setup Go environment
51-
uses: actions/setup-go@v4
52+
uses: actions/setup-go@v5
5253
with:
53-
go-version: '^1.21.1'
54+
go-version: stable
5455

5556
- run: yarn install --frozen-lockfile
5657

@@ -63,30 +64,29 @@ jobs:
6364
6465
- name: SonarCloud Scan
6566
uses: sonarsource/sonarcloud-github-action@master
67+
continue-on-error: true
6668
env:
67-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6870
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6971

7072
build:
7173
runs-on: ubuntu-latest
74+
timeout-minutes: 5
7275
steps:
7376
- uses: actions/checkout@v4
7477

7578
- id: extract_ref
7679
run: echo ::set-output name=GIT_REF::$(echo ${GITHUB_REF##*/})
7780

78-
- id: nvm
79-
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
80-
81-
- uses: actions/setup-node@v3
81+
- uses: actions/setup-node@v4
8282
with:
83-
node-version: '${{ steps.nvm.outputs.NVMRC }}'
83+
node-version-file: .nvmrc
8484
cache: yarn
8585

8686
- name: Setup Go environment
87-
uses: actions/setup-go@v4
87+
uses: actions/setup-go@v5
8888
with:
89-
go-version: '^1.21.1'
89+
go-version: stable
9090

9191
- run: yarn install --frozen-lockfile
9292

@@ -97,7 +97,7 @@ jobs:
9797
make VERSION=${{ steps.extract_ref.outputs.GIT_REF }} start-docker
9898
9999
- if: startsWith(github.ref, 'refs/tags/')
100-
uses: actions/upload-artifact@v3
100+
uses: actions/upload-artifact@v4
101101
with:
102102
name: smocker-bin
103103
path: ./build/smocker.tar.gz
@@ -106,13 +106,14 @@ jobs:
106106
needs: [lint, test, build]
107107
if: startsWith(github.ref, 'refs/tags/')
108108
runs-on: ubuntu-latest
109+
timeout-minutes: 10
109110
steps:
110111
- uses: actions/checkout@v4
111112

112113
- id: extract_ref
113114
run: echo ::set-output name=GIT_REF::$(echo ${GITHUB_REF##*/})
114115

115-
- uses: actions/download-artifact@v3
116+
- uses: actions/download-artifact@v4
116117
with:
117118
name: smocker-bin
118119
path: ./build
@@ -122,22 +123,21 @@ jobs:
122123
- name: Docker login
123124
uses: docker/login-action@v3
124125
with:
125-
username: ${{ secrets.DOCKER_USERNAME }}
126-
password: ${{ secrets.DOCKER_PASSWORD }}
126+
registry: ghcr.io
127+
username: ${{ github.actor }}
128+
password: ${{ secrets.GITHUB_TOKEN }}
127129

128130
- name: Set up QEMU
129131
uses: docker/setup-qemu-action@v3
132+
130133
- name: Set up Docker Buildx
131134
uses: docker/setup-buildx-action@v3
132-
with:
133-
platforms: linux/amd64,linux/arm64
134135

135136
- name: Deploy on Docker registry
136137
run: make VERSION=${{ steps.extract_ref.outputs.GIT_REF }} deploy-docker
137138

138139
- name: Deploy on GitHub releases
139-
uses: softprops/action-gh-release@v1
140+
uses: softprops/action-gh-release@v2
140141
with:
141142
files: build/smocker.tar.gz
142-
env:
143-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
143+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
.vscode/
44
build/
55
coverage/
6-
docs/.vuepress/dist/
76
node_modules/
87
sessions
98
!tests/sessions
109
smocker
1110
smocker.test
12-
vendor/
1311
yarn-error.log

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
FROM golang:1.18-alpine AS build-backend
1+
ARG GO_VERSION=1.22
2+
FROM golang:${GO_VERSION}-alpine AS build-backend
23
RUN apk add --no-cache make
34
ARG VERSION=snapshot
45
ARG COMMIT
5-
WORKDIR /go/src/github.com/Thiht/smocker
6+
WORKDIR /go/src/smocker
67
COPY go.mod go.sum ./
78
RUN go mod download
89
COPY Makefile main.go ./
910
COPY server/ ./server/
1011
RUN make VERSION=$VERSION COMMIT=$COMMIT RELEASE=1 build
1112

1213
FROM alpine
14+
LABEL org.opencontainers.image.source="https://github.com/smocker-dev/smocker"
1315
WORKDIR /opt
1416
EXPOSE 8080 8081
1517
COPY build/client client/
16-
COPY --from=build-backend /go/src/github.com/Thiht/smocker/build/* /opt/
18+
COPY --from=build-backend /go/src/smocker/build/* /opt/
1719
CMD ["/opt/smocker"]

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ ifeq ($(RELEASE), 1)
1515
endif
1616
GO_LDFLAGS:=-ldflags="$(GO_LDFLAGS)"
1717

18-
DOCKER_ACCOUNT?=thiht
19-
DOCKER_IMAGE=$(DOCKER_ACCOUNT)/$(APPNAME)
18+
DOCKER_IMAGE=ghcr.io/smocker-dev/smocker
2019

2120
# See: https://docs.docker.com/engine/reference/commandline/tag/#extended-description
2221
# A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes.
@@ -68,7 +67,7 @@ start: $(REFLEX) persistence
6867

6968
.PHONY: build
7069
build:
71-
go build $(GO_LDFLAGS) -o ./build/$(APPNAME)
70+
go build -trimpath $(GO_LDFLAGS) -o ./build/$(APPNAME)
7271

7372
.PHONY: lint
7473
lint: $(GOLANGCILINT)
@@ -136,7 +135,7 @@ build/smocker.tar.gz:
136135
$(MAKE) build
137136
yarn install --frozen-lockfile --ignore-scripts
138137
yarn build
139-
cd build/; tar -cvf smocker.tar.gz *
138+
cd build/; tar -czvf smocker.tar.gz *
140139

141140
.PHONY: release
142141
release: build/smocker.tar.gz
@@ -151,8 +150,9 @@ start-caddy: $(CADDY)
151150

152151
.PHONY: deploy-docker
153152
deploy-docker:
154-
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes; docker buildx create --use
153+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
154+
docker buildx create --use
155155
ifdef IS_SEMVER
156-
docker buildx build --push --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) --tag $(DOCKER_IMAGE):latest --platform linux/arm/v7,linux/arm64/v8,linux/amd64 .
156+
docker buildx build --push --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag $(DOCKER_IMAGE):latest .
157157
endif
158-
docker buildx build --push --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --platform linux/arm/v7,linux/arm64/v8,linux/amd64 .
158+
docker buildx build --push --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag $(DOCKER_IMAGE):$(DOCKER_TAG) .

README.md

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<h1 align="center">
2-
<img src="docs/.vuepress/public/logo/logo-horizontal.png" alt="Smocker" height="100" title="Smocker logo by mandyellow" />
2+
<img src="./docs/logo-horizontal.png" alt="Smocker" height="100" title="Smocker logo by mandyellow" />
33
</h1>
44

5-
[![CI](https://github.com/Thiht/smocker/actions/workflows/main.yml/badge.svg)](https://github.com/Thiht/smocker/actions/workflows/main.yml)
6-
[![Netlify Status](https://img.shields.io/netlify/61d4e090-b242-419f-8d69-e9dee3d50a37?logo=netlify)](https://app.netlify.com/sites/smocker/deploys)
7-
[![Docker Repository](https://img.shields.io/badge/docker-thiht%2Fsmocker-blue?logo=docker)](https://hub.docker.com/r/thiht/smocker)
8-
[![Github Release](https://img.shields.io/github/v/release/Thiht/smocker.svg?logo=github)](https://github.com/Thiht/smocker/releases/latest)
9-
[![Go Report Card](https://goreportcard.com/badge/github.com/Thiht/smocker)](https://goreportcard.com/report/github.com/Thiht/smocker)
10-
[![License](https://img.shields.io/github/license/Thiht/smocker?logo=open-source-initiative)](https://github.com/Thiht/smocker/blob/master/LICENSE)
5+
[![CI](https://github.com/smocker-dev/smocker/actions/workflows/main.yml/badge.svg)](https://github.com/smocker-dev/smocker/actions/workflows/main.yml)
6+
[![Docker Repository](https://img.shields.io/badge/ghcr.io%2Fsmocker--dev%2Fsmocker-blue?logo=docker&label=docker)](https://github.com/smocker-dev/smocker/pkgs/container/smocker)
7+
[![Github Release](https://img.shields.io/github/v/release/smocker-dev/smocker.svg?logo=github)](https://github.com/smocker-dev/smocker/releases/latest)
8+
[![Go Report Card](https://goreportcard.com/badge/github.com/smocker-dev/smocker)](https://goreportcard.com/report/github.com/smocker-dev/smocker)
9+
[![License](https://img.shields.io/github/license/smocker-dev/smocker?logo=open-source-initiative)](https://github.com/smocker-dev/smocker/blob/main/LICENSE)
1110

1211
**Smocker** (server mock) is a simple and efficient HTTP mock server.
1312

@@ -25,7 +24,6 @@ The documentation is available on [smocker.dev](https://smocker.dev).
2524
- [Development](#development)
2625
- [Backend](#backend)
2726
- [Frontend](#frontend)
28-
- [Documentation](#documentation)
2927
- [Docker](#docker)
3028
- [Caddy](#caddy)
3129
- [HTTPS](#https)
@@ -42,15 +40,15 @@ docker run -d \
4240
-p 8080:8080 \
4341
-p 8081:8081 \
4442
--name smocker \
45-
thiht/smocker
43+
ghcr.io/smocker-dev/smocker
4644
```
4745

4846
### Manual Deployment
4947

5048
```sh
5149
# This will be the deployment folder for the Smocker instance
5250
mkdir -p /opt/smocker && cd /opt/smocker
53-
wget -P /tmp https://github.com/Thiht/smocker/releases/latest/download/smocker.tar.gz
51+
wget -P /tmp https://github.com/smocker-dev/smocker/releases/latest/download/smocker.tar.gz
5452
tar xf /tmp/smocker.tar.gz
5553
nohup ./smocker -mock-server-listen-port=8080 -config-listen-port=8081 &
5654
```
@@ -65,9 +63,9 @@ curl localhost:8081/version
6563

6664
Smocker exposes a configuration user interface. You can access it in your web browser on http://localhost:8081/.
6765

68-
![History](docs/.vuepress/public/screenshots/screenshot-history.png)
66+
![History](docs/screenshots/screenshot-history.png)
6967

70-
![Mocks](docs/.vuepress/public/screenshots/screenshot-mocks.png)
68+
![Mocks](docs/screenshots/screenshot-mocks.png)
7169

7270
## Usage
7371

@@ -160,15 +158,6 @@ The frontend is written with TypeScript and React. You can use the following com
160158
- `yarn test`: execute unit tests
161159
- `yarn test:watch`: execute unit tests, with live reload
162160

163-
### Documentation
164-
165-
The documentation is written in Markdown using [Vuepress](https://vuepress.vuejs.org/). You can use the following commands to manage the documentation:
166-
167-
- `yarn install`: install the dependencies
168-
- `yarn docs:generate`: regenerate documentation screenshots (require the whole application to be started on the default ports)
169-
- `yarn docs:dev`: start the documentation in development mode, with live reload
170-
- `yarn docs:build`: generate the static production documentation
171-
172161
### Docker
173162

174163
The application can be packaged as a standalone Docker image. You can use the following commands to manage the development lifecycle:

client/components/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const App = () => (
4747
Smocker version {window.version} &ndash; MIT Licensed
4848
<br />
4949
<a
50-
href="https://github.com/Thiht/smocker"
50+
href="https://github.com/smocker-dev/smocker"
5151
title="Smocker on GitHub"
5252
target="_blank"
5353
rel="noreferrer"

0 commit comments

Comments
 (0)