Skip to content

Commit

Permalink
Merge pull request #7 from ammont82/new-workflow-actions
Browse files Browse the repository at this point in the history
Add Github workflow actions
  • Loading branch information
ammont82 authored Mar 1, 2024
2 parents 5ed46f4 + eb665d9 commit 21e23b9
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 6 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Pull request

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches:
- main
- releases/*

env:
NODE_OPTIONS: '--max-old-space-size=8192'
jobs:
preflight-check:
# Prevents running the workflow when a PR is marked as draft.
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if PR is draft
id: check
run: |
if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then
skip=true
else
skip=false
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
echo "skip=${skip}"
lint-and-test:
needs: preflight-check
if: needs.preflight-check.outputs.skip == 'false'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODEJS_VERSION }}
- run: npm install --immutable
- run: npm run lint
- run: npm run test --passWithNoTests
build:
needs: preflight-check
if: needs.preflight-check.outputs.skip == 'false'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODEJS_VERSION }}
- run: npm install --immutable
- run: npm run build
57 changes: 57 additions & 0 deletions .github/workflows/push-to-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Push to main or release tag

on:
push:
branches:
- main
tags:
- 'v*'

env:
QUAY_ORG: quay.io/edge-infrastructure
QUAY_REPO: assisted-installer-ui

jobs:
preflight-check:
# Prevents running the workflow when a brand-new tag points to the same commit as the main branch
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if a tag points to the same commit as the main branch
id: check
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]] && [[ "${GITHUB_SHA}" == "$(git rev-parse origin/main)" ]]; then
skip=true
else
skip=false
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
echo "skip=${skip}"
lint-and-test:
needs: preflight-check
if: needs.preflight-check.outputs.skip == 'false'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODEJS_VERSION }}
- run: npm install --immutable
- run: npm run lint
- run: npm run test --passWithNoTests
build:
needs: preflight-check
if: needs.preflight-check.outputs.skip == 'false'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODEJS_VERSION }}
- run: npm install --immutable
- run: npm run build
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"patch:hosts": "fec patch-etc-hosts",
"start": "HOT=true fec dev --clouddotEnv=stage --uiEnv=stable",
"start:federated": "fec static",
"test": "TZ=UTC jest --verbose --no-cache",
"test": "TZ=UTC jest --verbose --no-cache --passWithNoTests",
"postinstall": "ts-patch install && rimraf .cache",
"verify": "npm-run-all build lint test",
"prettier": "prettier --write src"
Expand Down
8 changes: 3 additions & 5 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';
import RootApp from './components/RootApp';

function bootstrap() {
const rootElement = document.getElementById('root');
render(React.createElement(RootApp), rootElement, () =>
rootElement?.setAttribute('data-ouia-safe', 'true'),
);
const root = createRoot(document.getElementById('root') as HTMLElement);
root.render(React.createElement(RootApp));
}

bootstrap();

0 comments on commit 21e23b9

Please sign in to comment.