Skip to content

Commit

Permalink
frontend dist reorg (#137)
Browse files Browse the repository at this point in the history
* include dist files

* add a frontend browser test
  • Loading branch information
joshlarsen authored Nov 4, 2024
1 parent 110993c commit 66b1b88
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 13 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docker.ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker UI
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build Docker container
run: docker build -t ui-app .

- name: Start Docker container
env:
HOST: 0.0.0.0
PORT: 8000
run: |
docker run -d -e HOST -e PORT -p 8000:8000 --name ui ui-app
sleep 5
- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Debug
run: curl -v http://localhost:8000

- name: Setup npm
run: npm init -y

- name: Install Playwright
run: npm install @playwright/test

- name: Install Playwright Browsers
run: npx playwright install chromium --with-deps

- name: Run Playwright tests
run: npx playwright test

15 changes: 3 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
name: Go Release

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
- name: Set up Go
uses: actions/setup-go@v5
-
name: Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

!config.yaml
!sample.env
!dist/**
!docs/**
!tests/**
!cmd/reaper/dist/**
!tls/*

Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN useradd -m -d /app -s /bin/bash app
WORKDIR /app
COPY . .
COPY --from=build /app/reaper .
COPY --from=build /app/cmd/reaper/dist ./dist
RUN chown -R app /app
USER app

Expand Down
11 changes: 11 additions & 0 deletions tests/docker-ui.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { test, expect } from '@playwright/test';

test('sign in button', async ({ page }) => {
await page.goto('http://localhost:8000');

// Click the sign in button.
await page.getByRole('button', { name: 'Sign in' }).click();

// Expects page to have a heading with Scan title.
await expect(page.getByRole('heading', { name: 'Scan' })).toBeVisible();
});

0 comments on commit 66b1b88

Please sign in to comment.