Skip to content

Commit

Permalink
Merge pull request #1072 from RedHatInsights/release_prod-stable.77046
Browse files Browse the repository at this point in the history
Deployment commit for prod-stable
  • Loading branch information
dlabrecq authored Apr 17, 2024
2 parents 458a1e2 + e0864b4 commit bf9f77e
Show file tree
Hide file tree
Showing 8 changed files with 437 additions and 223 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CI

on:
pull_request:
branches: [ main, prod-beta, prod-stable, stage-beta, stage-stable ]
push:
branches: [ main, prod-beta, prod-stable, stage-beta, stage-stable ]

env:
BRANCH: ${{ github.base_ref }}
NODEJS_VERSION: '18'

jobs:
build:
# This job is run for PRs only, as a sanity check, to confirm ci.ext.devshift.net is working properly
if: ${{ github.event_name == 'pull_request' }}
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODEJS_VERSION }}

- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Lint
run: npm run lint

units:
name: Units
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODEJS_VERSION }}

- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm install

- name: Test
id: test_run
run: npm test -- --collect-coverage --max-workers=4

- uses: actions/upload-artifact@v4
if: ${{ steps.test_run.outcome == 'success' }}
name: Save coverage report
with:
name: coverage_report
path: coverage/
retention-days: 10

coverage:
name: Coverage
needs: [units]
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage_report
path: coverage

- name: Upload coverage report
if: ${{ success() }}
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: coverage
plugin: pycoverage # Only run one plugin so that all do not run. There is no way to disable plugins entirely.
46 changes: 0 additions & 46 deletions .github/workflows/pull_request.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tag Release
on:
push:
branches:
- prod-stable
jobs:
tag_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: prod-stable
- run: |
git fetch --prune --unshallow
- name: Tag this release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DATE=$(date +"%Y.%m.%d")
PREV_RELEASE=$(git tag --list | tail -1)
MINOR_VERSION=0
case $PREV_RELEASE in
*"$DATE"*)
MINOR_VERSION="$PREV_RELEASE" | cut -d'.' -f5
MINOR_VERSION=$((MINOR_VERSION+1))
;;
*)
MINOR_VERSION=0
;;
esac
TAG="r.$DATE.$MINOR_VERSION"
git config --local user.email "[email protected]"
git config --local user.name "Hybrid Committed Spend Release Action"
git log $(git tag --list | tail -1)..prod-stable | git tag -a $TAG -F -
git push origin $TAG
shell: bash
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Hybrid Committed Spend UI

[![AGPLv3][license-badge]][license]
[![Build Status][build-badge]][build]
[![Apache 2.0][license-badge]](https://github.com/RedHatInsights/hybrid-committed-spend-ui/blob/main/LICENSE)
[![CI Status][build-badge]](https://github.com/RedHatInsights/hybrid-committed-spend-ui/actions/workflows/ci.yml?query=branch%3Amain)
[![codecov][codecov-badge]](https://codecov.io/gh/RedHatInsights/hybrid-committed-spend-ui)

React.js app for Red Hat Hybrid Committed Spend.

User interface is based on Red Hat cloud service frontend components and Patternfly [![Patternfly][pf-logo]][patternfly]
User interface is based on [Patternfly].

To submit an issue, please visit https://issues.redhat.com/projects/HCS/issues
Submit issues in [Jira].

## Requirements

* [NodeJS v18.15+][nodejs]
* [npm v9.5+][npm]

## Setup /etc/hosts entries (do this once)
## Setup `hosts` entries (do this once)

Edit the /etc/hosts file and add the following entries
Edit the `/etc/hosts` file and add the following entries
```
127.0.0.1 prod.foo.redhat.com
127.0.0.1 stage.foo.redhat.com
Expand All @@ -27,8 +29,9 @@ sudo bash scripts/patch-etc-hosts.sh
```

## Getting Started

1. Install requirements listed above.
2. Setup /etc/hosts entries listed above.
2. Setup `/etc/hosts` entries listed above.
3. Clone the repository, and open a terminal in the base of this project.
4. Run the command `npm install` to install all the dependencies.

Expand All @@ -43,6 +46,7 @@ npm test
```

## Running Hybrid Committed Spend UI against a hosted Billing API, using webpack proxy

Note that this approach currently supports the Insights stage-beta, stage-stable, prod-beta, and prod-stable environments.

1. Start development server
Expand All @@ -63,7 +67,7 @@ https://stage.foo.redhat.com:1337/beta/business-services/hybrid-committed-spend

### Running Hybrid Committed Spend UI with local Cloud Services Backend

See https://github.com/RedHatInsights/chrome-service-backend/blob/main/docs/cloud-services-config.md#serving-files-locally
Refer to the [serving files locally][serving-files-locally] section of cloud services config for more details

1. Serve files locally from Cloud Services Backend repo
```
Expand All @@ -79,13 +83,13 @@ npm start:csb

This [release][release-doc] doc describes how to release Hybrid Committed Spend UI to each staging environment.

[build]: https://app.travis-ci.com/github/RedHatInsights/hybrid-committed-spend-ui
[build-badge]: https://img.shields.io/travis/RedHatInsights/hybrid-committed-spend-ui.svg?style=for-the-badge
[license-badge]: https://img.shields.io/github/license/RedHatInsights/hybrid-committed-spend-ui.svg?longCache=true&style=for-the-badge
[license]: https://github.com/RedHatInsights/hybrid-committed-spend-ui/blob/main/LICENSE
[build-badge]: https://github.com/RedHatInsights/hybrid-committed-spend-ui/actions/workflows/ci.yml/badge.svg?branch=main
[codecov-badge]: https://codecov.io/gh/RedHatInsights/hybrid-committed-spend-ui/graph/badge.svg?token=1hjFIy1cRe
[Jira]: https://issues.redhat.com/projects/HCS/
[license-badge]: https://img.shields.io/github/license/RedHatInsights/hybrid-committed-spend-ui.svg?longCache=true
[nodejs]: https://nodejs.org/en/
[npm]: https://www.npmjs.com/
[patch-etc-hosts]: https://github.com/RedHatInsights/insights-proxy/blob/master/scripts/patch-etc-hosts.sh
[pf-logo]: https://www.patternfly.org/v4/images/logo.4189e7eb1a0741ea2b3b51b80d33c4cb.svg
[patternfly]: https://www.patternfly.org/
[Patternfly]: https://www.patternfly.org/
[release-doc]: https://github.com/RedHatInsights/hybrid-committed-spend-ui/blob/main/RELEASE.md
[npm]: https://https://www.npmjs.com/
[serving-files-locally]: https://github.com/RedHatInsights/chrome-service-backend/blob/main/docs/cloud-services-config.md#serving-files-locally
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
$schema: 'http://json.schemastore.org/swcrc',
jsc: {
experimental: {
plugins: [['jest_workaround', {}]],
plugins: [['swc_mut_cjs_exports', {}]],
},
parser: {
jsx: true,
Expand Down
Loading

0 comments on commit bf9f77e

Please sign in to comment.