Skip to content

Commit

Permalink
Merge pull request #879 from runtipi/release/2.1.0
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
meienberger committed Nov 7, 2023
2 parents bf8f635 + f38c341 commit df59d21
Show file tree
Hide file tree
Showing 77 changed files with 1,915 additions and 1,154 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/alpha-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,22 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/runtipi:${{ needs.create-tag.outputs.tagname }}
cache-from: type=registry,ref=meienberger/runtipi:buildcache
cache-to: type=registry,ref=meienberger/runtipi:buildcache,mode=max
tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.create-tag.outputs.tagname }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache,mode=max

build-cli:
runs-on: ubuntu-latest
Expand All @@ -65,7 +66,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -40,21 +40,22 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/runtipi:${{ needs.get-tag.outputs.tag }}
cache-from: type=registry,ref=meienberger/runtipi:buildcache
cache-to: type=registry,ref=meienberger/runtipi:buildcache,mode=max
tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.get-tag.outputs.tag }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache,mode=max

build-cli:
runs-on: ubuntu-latest
Expand All @@ -64,7 +65,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v1
uses: SimenB/github-actions-cpu-cores@v2

- name: Run tests
run: pnpm run test --max-workers ${{ steps.cpu-cores.outputs.count }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/release-candidate.yml

This file was deleted.

19 changes: 10 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -36,21 +36,22 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: meienberger/runtipi:latest,meienberger/runtipi:${{ needs.get-tag.outputs.tag }}
cache-from: type=registry,ref=meienberger/runtipi:buildcache
cache-to: type=registry,ref=meienberger/runtipi:buildcache,mode=max
tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.get-tag.outputs.tag }},ghcr.io/${{ github.repository_owner }}/runtipi:latest
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache,mode=max

build-cli:
runs-on: ubuntu-latest
Expand All @@ -61,7 +62,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
![Build](https://github.com/runtipi/runtipi/workflows/Tipi%20CI/badge.svg)
[![Crowdin](https://badges.crowdin.net/runtipi/localized.svg)](https://crowdin.com/project/runtipi)

> 💡 Tipi is built with TypeScript, Next.js app router and Drizzle ORM! If you want to collaborate on a cool project, join the discussion on Discord!
#### Join the discussion

[![Discord](https://img.shields.io/discord/976934649643294750?label=discord&logo=discord)](https://discord.gg/Bu9qEPnHsc)
Expand Down
48 changes: 48 additions & 0 deletions e2e/0004-user-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { test, expect } from '@playwright/test';
import { loginUser } from './fixtures/fixtures';
import { clearDatabase } from './helpers/db';
import { testUser } from './helpers/constants';
import { setSettings } from './helpers/settings';

test.beforeEach(async ({ page }) => {
await setSettings({});
await clearDatabase();
await loginUser(page);

Expand Down Expand Up @@ -31,3 +33,49 @@ test('user can change their password', async ({ page }) => {

await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
});

test('user can change their email', async ({ page }) => {
// Change email
const newEmail = 'tester2@test.com';

await page.getByRole('tab', { name: 'Security' }).click();
await page.getByRole('button', { name: 'Change username' }).click();
await page.getByPlaceholder('New username').click();
await page.getByPlaceholder('New username').fill(newEmail);

// Wrong password
await page.getByPlaceholder('Password', { exact: true }).click();
await page.getByPlaceholder('Password', { exact: true }).fill('incorrect');

await page.getByRole('button', { name: 'Change username' }).click();

await expect(page.getByText('Invalid password')).toBeVisible();

// Wrong email
await page.getByPlaceholder('Password', { exact: true }).click();
await page.getByPlaceholder('Password', { exact: true }).fill(testUser.password);
await page.getByPlaceholder('New username').click();
await page.getByPlaceholder('New username').fill('incorrect');

await page.getByRole('button', { name: 'Change username' }).click();

await expect(page.getByText('Must be a valid email address')).toBeVisible();

// Correct email and password
await page.getByPlaceholder('New username').click();
await page.getByPlaceholder('New username').fill(newEmail);

await page.getByRole('button', { name: 'Change username' }).click();

await expect(page.getByText('Username changed successfully')).toBeVisible();

// Login with new email
await page.getByPlaceholder('you@example.com').click();
await page.getByPlaceholder('you@example.com').fill(newEmail);
await page.getByPlaceholder('Your password').click();
await page.getByPlaceholder('Your password').fill(testUser.password);

await page.getByRole('button', { name: 'Login' }).click();

await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
});
58 changes: 58 additions & 0 deletions e2e/0005-guest-dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { test, expect } from '@playwright/test';
import { appTable } from '@/server/db/schema';
import { setSettings } from './helpers/settings';
import { loginUser } from './fixtures/fixtures';
import { clearDatabase, db } from './helpers/db';

test.beforeEach(async () => {
await clearDatabase();
await setSettings({});
});

test('user can activate the guest dashboard and see it when logged out', async ({ page }) => {
await loginUser(page);
await page.goto('/settings');

await page.getByRole('tab', { name: 'Settings' }).click();
await page.getByLabel('guestDashboard').setChecked(true);
await page.getByRole('button', { name: 'Save' }).click();
await page.getByTestId('logout-button').click();

await expect(page.getByText('No apps to display')).toBeVisible();
});

test('logged out users can see the apps on the guest dashboard', async ({ browser }) => {
await setSettings({ guestDashboard: true });
await db.insert(appTable).values({ config: {}, isVisibleOnGuestDashboard: true, id: 'hello-world', exposed: true, domain: 'duckduckgo.com', status: 'running' });
await db.insert(appTable).values({ config: {}, isVisibleOnGuestDashboard: false, id: 'actual-budget', exposed: false, status: 'running' });

const context = await browser.newContext();
const page = await context.newPage();
await page.goto('/');
await expect(page.getByText(/Hello World web server/)).toBeVisible();
const locator = page.locator('text=Actual Budget');
expect(locator).not.toBeVisible();

const [newPage] = await Promise.all([context.waitForEvent('page'), await page.getByRole('link', { name: /Hello World/ }).click()]);

await newPage.waitForLoadState();
expect(newPage.url()).toBe('https://duckduckgo.com/');
await newPage.close();

await context.close();
});

test('user can deactivate the guest dashboard and not see it when logged out', async ({ page }) => {
await loginUser(page);
await page.goto('/settings');

await page.getByRole('tab', { name: 'Settings' }).click();
await page.getByLabel('guestDashboard').setChecked(false);
await page.getByRole('button', { name: 'Save' }).click();
await page.getByTestId('logout-button').click();

await page.goto('/');

// We should be redirected to the login page
await expect(page.getByRole('heading', { name: 'Login' })).toBeVisible();
});
2 changes: 2 additions & 0 deletions e2e/helpers/global-setup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { clearDatabase } from './db';
import { setSettings } from './settings';

/**
*
*/
async function globalSetup() {
await clearDatabase();
await setSettings({});
}

export default globalSetup;
8 changes: 8 additions & 0 deletions e2e/helpers/settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { promises } from 'fs';
import path from 'path';
import { z } from 'zod';
import { settingsSchema } from '@runtipi/shared';

export const setSettings = async (settings: z.infer<typeof settingsSchema>) => {
await promises.writeFile(path.join(__dirname, '../../state/settings.json'), JSON.stringify(settings));
};
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
1 change: 0 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const nextConfig = {
transpilePackages: ['@runtipi/shared'],
experimental: {
serverComponentsExternalPackages: ['bullmq'],
serverActions: true,
},
serverRuntimeConfig: {
INTERNAL_IP: process.env.INTERNAL_IP,
Expand Down

0 comments on commit df59d21

Please sign in to comment.