Skip to content

Commit

Permalink
fix: github action dependencies (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian authored Jun 6, 2023
1 parent 425205e commit 5e22c7b
Show file tree
Hide file tree
Showing 68 changed files with 21,804 additions and 37,594 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.github
action
app/frontend/cypress
app/frontend/cypress.config.ts
comparadise-utils
cypress
dist
node_modules
*.md
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

13 changes: 7 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
reviewers:
- '@ExpediaGroup/comparadise-committers'
# TODO: enable once dependabot supports pnpm
# - package-ecosystem: 'pnpm'
# directory: '/'
# schedule:
# interval: 'weekly'
# reviewers:
# - '@ExpediaGroup/comparadise-committers'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,26 @@ jobs:

publish-comparadise-utils:
runs-on: ubuntu-latest
defaults:
run:
working-directory: comparadise-utils
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Install
run: npm ci
run: pnpm --filter comparadise-utils install

- name: Build
run: npm run build
- name: Set Version Environment Variable
run: |
VERSION_TAG=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
echo NEW_VERSION="${VERSION_TAG:1}" >> $GITHUB_ENV
- name: Publish
run: |
npm config set _authToken=${{ secrets.NPM_TOKEN }}
VERSION_TAG=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
npm version "${VERSION_TAG:1}"
npm publish
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} >> .npmrc
pnpm --filter comparadise-utils bump-version
pnpm --filter comparadise-utils publish --no-git-checks
publish-tags:
runs-on: ubuntu-latest
Expand Down
118 changes: 10 additions & 108 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,32 @@ on:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
lint:
name: Lint
test:
name: All Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}

- name: Validate package.json
uses: ExpediaGroup/package-json-validator@v1
with:
rules: ranges
dependency-types: |
dependencies
devDependencies
- uses: nrwl/nx-set-shas@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Install
run: npm ci

- name: Type Check
run: tsc
run: pnpm install

- name: Lint
run: npm run lint

- name: Format
run: npm run format

- name: Package
run: npm run package
- name: Test
run: pnpm nx affected --target=test

- name: Check for any generated code that should be committed
run: |
Expand All @@ -61,85 +45,3 @@ jobs:
git push
exit 1
fi
backend:
name: Backend Tests
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install
run: npm ci

- name: Test
run: npm run test:backend

frontend:
name: Frontend Tests
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install and Test
uses: cypress-io/github-action@v5
with:
component: true

integration:
name: Integration Tests
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install
run: npm ci

- name: Run Cypress Tests Against Docker Container
run: npm run test:integration

utils:
name: Utils Tests
needs:
- lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: comparadise-utils
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
registry = https://registry.npmjs.org
enable-pre-post-scripts=true
registry=https://registry.npmjs.org
use-node-version=18.16.0
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

7 changes: 4 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
utils/types/
node_modules/
action/
app/
comparadise-utils/
shared/
19 changes: 4 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
# Local Development
# Local App Development

1. Run `nvm use`
2. Run `npm install`
1. Install `pnpm`
2. Run `pnpm install`
3. Login to the AWS account containing the visual regression S3 bucket
4. Run `npm run dev`
4. Run `nx local app`
5. Application will be running at `http://localhost:5173`, and it will hot reload when you make changes.

You can also run the app using docker-compose using `npm run build:docker`!

Make sure you have a `secrets.json` file in the root of the project in order to test using application secrets.
This file should have the following format:

```json
{
"github_token": "MY_TOKEN"
}
```
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM node:18-slim
FROM node:18.16.0-slim

WORKDIR /app

RUN apt-get update && apt-get -qq -y install curl
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm

RUN useradd -ms /bin/sh admin
RUN chown -R admin .
COPY --chown=admin . .
USER admin

ENV PORT 8080
RUN pnpm install --ignore-scripts
RUN pnpm nx build frontend

RUN npm ci
RUN npm run build

CMD [ "npm", "run", "start:backend" ]
ENV PORT 8080
CMD [ "pnpm", "nx", "start", "app" ]
1 change: 1 addition & 0 deletions action/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
Loading

0 comments on commit 5e22c7b

Please sign in to comment.