Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to nuxt3 #144

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .browserslistrc

This file was deleted.

5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ infra/
/test-results-docker/
test-results-docker-ent/
test-results-docker-org/

.nuxt/
.output/
.vscode/
dist/
23 changes: 12 additions & 11 deletions .env
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# Determines if mocked data should be used instead of making API calls.
VUE_APP_MOCKED_DATA=true
NUXT_PUBLIC_IS_DATA_MOCKED=true

# Determines the scope of the API calls.
# Can be 'enterprise' or 'organization' to target API calls to an enterprise or an organization respectively.
VUE_APP_SCOPE=organization
NUXT_PUBLIC_SCOPE=organization

# Determines the enterprise or organization name to target API calls.
VUE_APP_GITHUB_ORG=octodemo
NUXT_PUBLIC_GITHUB_ORG=octodemo

VUE_APP_GITHUB_ENT=
NUXT_PUBLIC_GITHUB_ENT=

# Determines the team name if exists to target API calls.
VUE_APP_GITHUB_TEAM=
NUXT_PUBLIC_GITHUB_TEAM=

NUXT_PUBLIC_USING_GITHUB_AUTH=false

# Determines the GitHub Personal Access Token to use for API calls.
# Create with scopes copilot, manage_billing:copilot or manage_billing:enterprise, read:enterprise AND read:org
VUE_APP_GITHUB_TOKEN=
# NUXT_GITHUB_TOKEN=<TOKEN>

# GitHub Api Url
# for proxy api - set to /api/github defaults to https://api.github.com
VUE_APP_GITHUB_API=
NUXT_SESSION_PASSWORD=something_long_and_random_thats_at_least_32_characters

# Random string used in API to secure session, use when VUE_APP_GITHUB_API=/api/github
#SESSION_SECRET=randomstring
# for Github OAuth
NUXT_OAUTH_GITHUB_CLIENT_ID=
NUXT_OAUTH_GITHUB_CLIENT_SECRET=
19 changes: 0 additions & 19 deletions .eslintrc.js

This file was deleted.

46 changes: 4 additions & 42 deletions .github/workflows/deploy_to_ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
# this is back a single image, `-with-proxy` is legacy and will be removed
images: |
ghcr.io/${{ github.repository }}
ghcr.io/${{ github.repository }}-with-proxy
labels: |
org.opencontainers.image.title=copilot-metrics-viewer
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
Expand All @@ -52,47 +55,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
push: true

push_proxy_to_ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4

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

# Adding below tag any push to main as "latest"
# To deploy latest, create a release with a semver tag
# type=raw,value=latest,enable={{is_default_branch}}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-with-proxy
labels: |
org.opencontainers.image.title=copilot-metrics-viewer-with-proxy
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
org.opencontainers.image.source=${{ github.repository }}
tags: |
type=sha
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Build and push api
uses: docker/build-push-action@v5
with:
context: .
file: api.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

deploy:
runs-on: ubuntu-latest
needs: push_to_ghcr
Expand Down
48 changes: 3 additions & 45 deletions .github/workflows/deploy_to_ghcr_custom_tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
images: |
ghcr.io/${{ github.repository }}
ghcr.io/${{ github.repository }}-with-proxy
labels: |
org.opencontainers.image.title=copilot-metrics-viewer
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
Expand All @@ -53,47 +55,3 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

push_proxy_to_ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
ref: ${{ github.event.inputs.tag }}


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

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-with-proxy
labels: |
org.opencontainers.image.title=copilot-metrics-viewer-with-proxy
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
org.opencontainers.image.source=${{ github.repository }}
tags: |
type=raw,enable=true,priority=1,value=${{ github.event.inputs.tag }}
type=sha
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Build and push api
uses: docker/build-push-action@v5
with:
context: .
file: api.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

49 changes: 3 additions & 46 deletions .github/workflows/deploy_to_ghcr_tag_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ jobs:
exit 1
fi

cd api
npm version from-git --no-git-tag-version
cd ..
git add .
git commit --signoff --message $version

Expand Down Expand Up @@ -80,7 +77,9 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
images: |
ghcr.io/${{ github.repository }}
ghcr.io/${{ github.repository }}-with-proxy
labels: |
org.opencontainers.image.title=copilot-metrics-viewer
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
Expand All @@ -99,45 +98,3 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

push_proxy_to_ghcr:
runs-on: ubuntu-latest
needs: version_update
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

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

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-with-proxy
labels: |
org.opencontainers.image.title=copilot-metrics-viewer-with-proxy
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
org.opencontainers.image.source=${{ github.repository }}
tags: |
type=sha
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Build and push api
uses: docker/build-push-action@v5
with:
context: .
file: api.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

60 changes: 12 additions & 48 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,51 +32,22 @@ jobs:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Build the app
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
- name: Run Vite tests
run: CI=true npm test
- name: Run Playwright tests
run: CI=true RUN_COMMAND='npm run preview' npm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30

test-api-org:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
file: api.Dockerfile
load: true
tags: api:test
build-args: mode=playwright
- name: Run Playwright tests
run: |
docker run --rm --name playwright \
-v $(pwd)/test-results-docker-org:/test-results \
-e CI=true \
-e VUE_APP_SCOPE=organization \
-e VUE_APP_GITHUB_ORG=octodemo \
-e VUE_APP_GITHUB_API=/api/github \
-e APP_MOCKED_DATA=true \
-e VUE_APP_GITHUB_TOKEN=dummy \
-e SESSION_SECRET=dummy \
api:test "@org"
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-docker-org
path: test-results-docker-org/
retention-days: 30

test-api-ent:
test-docker-playwright:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
Expand All @@ -86,25 +57,18 @@ jobs:
- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
file: api.Dockerfile
load: true
tags: api:test
tags: app:pw
build-args: mode=playwright
- name: Run Playwright tests
run: |
docker run --rm --name playwright \
-v $(pwd)/test-results-docker-ent:/test-results \
-e CI=true \
-e VUE_APP_SCOPE=enterprise \
-e VUE_APP_GITHUB_ENT=octodemo \
-e VUE_APP_GITHUB_API=/api/github \
-e APP_MOCKED_DATA=true \
-e VUE_APP_GITHUB_TOKEN=dummy \
-e SESSION_SECRET=dummy \
api:test "@ent"
-v $(pwd)/test-results-docker:/test-results \
-e NUXT_SESSION_PASSWORD=foo-foo-foo-foo-foo-foo-foo-foo-foo-foo-foo-foo \
app:pw
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-docker-ent
path: test-results-docker-ent/
name: playwright-report-docker
path: test-results-docker/
retention-days: 30
Loading
Loading