-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a4ca2b
commit a5156f1
Showing
23 changed files
with
3,918 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Workflow Demo SPA | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- '*' | ||
paths: | ||
- '*' | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Bump Version | ||
default: v1.0.0 | ||
required: true | ||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Registries | ||
env: | ||
IMAGE_NAME: "workflow" | ||
REGISTRY_NAMESPACE: ${{ secrets.REGISTRY_NAMESPACE }} | ||
USERGROUP: ${{ secrets.USER_GROUP }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v3.x | ||
|
||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Quay.io | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.CI_QUAY_USERNAME }} | ||
password: ${{ secrets.CI_QUAY_TOKEN }} | ||
|
||
- name: Build and push into repository | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} | ||
build-args: USERGROUP=${{secrets.USER_GROUP}} | ||
tags: | | ||
quay.io/${{ env.REGISTRY_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{env.GITHUB_REF_SLUG}} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Lighthouse Audit | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- '*' | ||
paths: | ||
- '*' | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Bump Version | ||
default: v1.0.0 | ||
required: true | ||
|
||
jobs: | ||
lighthouse: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install Dependencies | ||
run: npm install -g lighthouse | ||
|
||
- name: Run Lighthouse | ||
run: | | ||
lighthouse --no-enable-error-reporting --chrome-flags="--headless --disable-gpu" https://www.npmjs.com/package/@spotify/lighthouse-audit-service --output json html --output-path=./.lighthouseci/one-platform-test-env | ||
- name: Commit Lighthouse Reports | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GIT_TOKEN }} | ||
script: | | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
// Import GitHub context | ||
const github = require('@actions/github'); | ||
// Read the contents of the reports directory | ||
const reportsPath = '.lighthouseci'; | ||
const reports = fs.readdirSync(reportsPath); | ||
// Commit the reports to the repository | ||
const { data } = await github.rest.repos.createOrUpdateFile({ | ||
owner: github.context.repo.owner, | ||
repo: github.context.repo.repo, | ||
path: 'lighthouse-reports', | ||
message: 'Add Lighthouse Reports', | ||
content: Buffer.from(reports.join('\n')).toString('base64'), | ||
}); | ||
console.log(`Lighthouse reports committed. SHA: ${data.content.sha}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Use the official Node.js image as the base | ||
FROM node:18-alpine3.16 | ||
|
||
ARG TESTWORKFLOW | ||
ARG DEMOWORKFLOW | ||
ARG USERGROUP | ||
|
||
RUN addgroup allusers && adduser -S -G allusers $USERGROUP | ||
RUN mkdir /.npm | ||
RUN mkdir /.npm/_cacache | ||
|
||
RUN echo "Build argument value of TESTWORKFLOW : ${TESTWORKFLOW}" | ||
RUN echo "Build argument value of DEMOWORKFLOW : ${DEMOWORKFLOW}" | ||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install --production | ||
|
||
# Copy the rest of the application | ||
COPY . . | ||
|
||
# Set environment variables | ||
ENV NODE_ENV=production | ||
|
||
# Build the application | ||
RUN npm run build | ||
|
||
# Remove development dependencies | ||
RUN npm prune --production | ||
|
||
RUN chown -R $USERGROUP:allusers . | ||
RUN chown -R $USERGROUP:allusers ~/.npm | ||
RUN chown -R $USERGROUP:allusers /.npm | ||
RUN chmod -R 777 . | ||
EXPOSE 3000 | ||
USER $USERGROUP | ||
|
||
# Start the application | ||
CMD ["npm", "start"] |
Oops, something went wrong.