Skip to content

Commit aaf9205

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents b152cfe + eca6b06 commit aaf9205

File tree

119 files changed

+4996
-3446
lines changed

Some content is hidden

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

119 files changed

+4996
-3446
lines changed

.github/workflows/cd-cloud.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create docker images
1+
name: Create docker images (cloud)
22

33
on:
44
push:

.github/workflows/cd-manual.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/cd.yml

Lines changed: 82 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,101 @@
11
name: Create docker images
22

3-
on: [create]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
- dev
9+
# Publish semver tags as releases.
10+
tags: [ 'v*.*.*' ]
11+
pull_request:
12+
branches:
13+
- master
14+
- main
15+
- dev
16+
workflow_dispatch:
417

518
jobs:
619
build:
720
name: Build, push, and deploy
8-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
921
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
# This is used to complete the identity challenge
26+
# with sigstore/fulcio when running outside of PRs.
27+
id-token: write
1028

1129
strategy:
1230
matrix:
1331
db-type: [postgresql, mysql]
1432

1533
steps:
16-
- uses: actions/checkout@v3
17-
18-
- name: Set env
19-
run: |
20-
echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
21-
22-
- name: Generate tags
23-
id: generate_tags
24-
run: |
25-
echo "tag_patch=$(echo ${{ matrix.db-type }})-${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
26-
echo "tag_minor=$(echo ${{ matrix.db-type }})-$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f1,2)" >> $GITHUB_ENV
27-
echo "tag_major=$(echo ${{ matrix.db-type }})-$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f1)" >> $GITHUB_ENV
28-
echo "tag_latest=$(echo ${{ matrix.db-type }})-latest" >> $GITHUB_ENV
29-
30-
- uses: mr-smithers-excellent/docker-build-push@v6
31-
name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }}
34+
- uses: actions/checkout@v5
35+
36+
# Install the cosign tool except on PR
37+
# https://github.com/sigstore/cosign-installer
38+
- name: Install cosign
39+
if: github.event_name != 'pull_request'
40+
uses: sigstore/cosign-installer@v3
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Log into registry docker.io
46+
if: github.event_name != 'pull_request' && github.repository == 'umami-software/umami'
47+
uses: docker/login-action@v3
48+
with:
49+
registry: docker.io
50+
username: ${{ secrets.DOCKER_USERNAME }}
51+
password: ${{ secrets.DOCKER_PASSWORD }}
52+
53+
- name: Log into ghcr registry
54+
if: github.event_name != 'pull_request'
55+
uses: docker/login-action@v3
3256
with:
33-
image: umami
34-
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
35-
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
3657
registry: ghcr.io
37-
multiPlatform: true
38-
platform: linux/amd64,linux/arm64
3958
username: ${{ github.actor }}
4059
password: ${{ secrets.GITHUB_TOKEN }}
4160

42-
- uses: mr-smithers-excellent/docker-build-push@v6
43-
name: Build & push Docker image to docker.io for ${{ matrix.db-type }}
61+
- name: Extract Docker metadata
62+
id: meta
63+
uses: docker/metadata-action@v5
4464
with:
45-
image: umamisoftware/umami
46-
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
47-
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
48-
registry: docker.io
49-
username: ${{ secrets.DOCKER_USERNAME }}
50-
password: ${{ secrets.DOCKER_PASSWORD }}
65+
images: |
66+
umamisoftware/umami,enable=${{ github.repository == 'umami-software/umami' }}
67+
ghcr.io/${{ github.repository }}
68+
flavor: |
69+
latest=auto
70+
prefix=${{ matrix.db-type }}-
71+
tags: |
72+
type=ref,event=branch
73+
type=ref,event=pr
74+
75+
# output 1.1.2
76+
type=semver,pattern={{version}}
77+
# output 1.1
78+
type=semver,pattern={{major}}.{{minor}}
79+
# output 1
80+
type=semver,pattern={{major}}
81+
82+
- name: Build and push Docker image
83+
id: build-and-push
84+
uses: docker/build-push-action@v6
85+
with:
86+
context: .
87+
platforms: linux/amd64,linux/arm64
88+
build-args: DATABASE_TYPE=${{ matrix.db-type }}
89+
push: ${{ github.event_name != 'pull_request' }}
90+
tags: ${{ steps.meta.outputs.tags }}
91+
labels: ${{ steps.meta.outputs.labels }}
92+
cache-from: type=gha
93+
cache-to: type=gha,mode=max
94+
95+
# Sign the resulting Docker image digest except on PRs.
96+
- name: Sign the published Docker image
97+
if: ${{ github.event_name != 'pull_request' }}
98+
env:
99+
TAGS: ${{ steps.meta.outputs.tags }}
100+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
101+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes "{}@${DIGEST}"

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,26 @@ jobs:
1919
matrix:
2020
include:
2121
- node-version: 18.18
22+
pnpm-version: 10
2223
db-type: postgresql
2324
- node-version: 18.18
25+
pnpm-version: 10
2426
db-type: mysql
2527

2628
steps:
2729
- uses: actions/checkout@v4
30+
- uses: pnpm/action-setup@v4 # required so that setup-node will work
31+
with:
32+
version: ${{ matrix.pnpm-version }}
33+
run_install: false
2834
- name: Use Node.js ${{ matrix.node-version }}
2935
uses: actions/setup-node@v4
3036
with:
3137
node-version: ${{ matrix.node-version }}
32-
cache: 'yarn'
38+
cache: 'pnpm'
3339
env:
3440
DATABASE_TYPE: ${{ matrix.db-type }}
35-
- run: npm install --global yarn
36-
- run: yarn install
37-
- run: yarn test
38-
- run: yarn build
41+
- run: npm install --global pnpm
42+
- run: pnpm install
43+
- run: pnpm test
44+
- run: pnpm build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
node_modules
55
.pnp
66
.pnp.js
7+
.pnpm-store
78

89
# testing
910
/coverage

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ A detailed getting started guide can be found at [umami.is/docs](https://umami.i
4343
```bash
4444
git clone https://github.com/umami-software/umami.git
4545
cd umami
46-
npm install
46+
pnpm install
4747
```
4848

4949
### Configure Umami
@@ -64,15 +64,15 @@ mysql://username:mypassword@localhost:3306/mydb
6464
### Build the Application
6565

6666
```bash
67-
npm run build
67+
pnpm run build
6868
```
6969

7070
_The build step will create tables in your database if you are installing for the first time. It will also create a login user with username **admin** and password **umami**._
7171

7272
### Start the Application
7373

7474
```bash
75-
npm run start
75+
pnpm run start
7676
```
7777

7878
_By default, this will launch the application on `http://localhost:3000`. You will need to either [proxy](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) requests from your web server or change the [port](https://nextjs.org/docs/api-reference/cli#production) to serve the application directly._
@@ -107,8 +107,8 @@ To get the latest features, simply do a pull, install any new dependencies, and
107107

108108
```bash
109109
git pull
110-
npm install
111-
npm run build
110+
pnpm install
111+
pnpm run build
112112
```
113113

114114
To update the Docker image, simply pull the new images and rebuild:

cypress/e2e/api-website.cy.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { uuid } from '../../src/lib/crypto';
2+
13
describe('Website API tests', () => {
24
Cypress.session.clearAllSavedSessions();
35

@@ -65,6 +67,37 @@ describe('Website API tests', () => {
6567
});
6668
});
6769

70+
it('Creates a website with a fixed ID.', () => {
71+
cy.fixture('websites').then(data => {
72+
const websiteCreate = data.websiteCreate;
73+
const fixedId = uuid();
74+
cy.request({
75+
method: 'POST',
76+
url: '/api/websites',
77+
headers: {
78+
'Content-Type': 'application/json',
79+
Authorization: Cypress.env('authorization'),
80+
},
81+
body: { ...websiteCreate, id: fixedId },
82+
}).then(response => {
83+
expect(response.status).to.eq(200);
84+
expect(response.body).to.have.property('id', fixedId);
85+
expect(response.body).to.have.property('name', 'Cypress Website');
86+
expect(response.body).to.have.property('domain', 'cypress.com');
87+
88+
// cleanup
89+
cy.request({
90+
method: 'DELETE',
91+
url: `/api/websites/${fixedId}`,
92+
headers: {
93+
'Content-Type': 'application/json',
94+
Authorization: Cypress.env('authorization'),
95+
},
96+
});
97+
});
98+
});
99+
});
100+
68101
it('Returns all tracked websites.', () => {
69102
cy.request({
70103
method: 'GET',
@@ -116,6 +149,21 @@ describe('Website API tests', () => {
116149
});
117150
});
118151

152+
it('Updates a website with only shareId.', () => {
153+
cy.request({
154+
method: 'POST',
155+
url: `/api/websites/${websiteId}`,
156+
headers: {
157+
'Content-Type': 'application/json',
158+
Authorization: Cypress.env('authorization'),
159+
},
160+
body: { shareId: 'ABCDEF' },
161+
}).then(response => {
162+
expect(response.status).to.eq(200);
163+
expect(response.body).to.have.property('shareId', 'ABCDEF');
164+
});
165+
});
166+
119167
it('Resets a website by removing all data related to the website.', () => {
120168
cy.request({
121169
method: 'POST',

0 commit comments

Comments
 (0)