Skip to content

Commit

Permalink
chore: Setup CI & release workflows, clean up README, remove js bundle (
Browse files Browse the repository at this point in the history
#24)

This PR serves as an example for all other marketplace viz repos.
- Sets up a CI workflow that calls our reusable CI marketplace viz
workflow. Currently this CI workflow will only build the viz.
Testing/lint can be added later, but will require cleaning up and
standardizing testing/linting across every repo.
- Sets up a release workflow that calls our reusable release marketplace
viz workflow.
- Updates README with standard copy and local development directions.
- Updates webpack to output bundle js into new `dist` directory that is
git ignored. Removed bundled js from source control, as its not source
and can be become out of sync and unreliable.
- We now bundle the JS on release and attach the bundle to the release.
Manual bundling can still be done if needed.
- **Our release workflow depends on the bundle js being generated by the
`yarn build` command into the `dist` directory.**
  • Loading branch information
jeremytchang authored Jan 1, 2024
1 parent 2c0e133 commit 0ed2efb
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 121 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: ci-workflow
on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
ci-build-job:
uses: looker-open-source/reusable-actions/.github/workflows/marketplace-viz-ci-build.yml@main
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ci-release-workflow

on:
push:
branches:
- master
workflow_dispatch:

# Cancels any release workflows in progress
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
ci-release-job:
permissions:
contents: write
pull-requests: write
uses: looker-open-source/reusable-actions/.github/workflows/marketplace-viz-release.yml@main
# Inherits the Looker Automation Bot token to create release PRs and releases
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
node_modules/
dist/
81 changes: 24 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,40 @@
# Radial Gauge Visualization

### What if I find an error? Suggestions for improvements?
### What if I find an error or want to suggest improvements?

Great! Marketplace content -- including visualizations -- were designed for continuous improvement through the help of the entire Looker community and we'd love your input. To report an error or improvement recommendation, please get in touch at help.looker.com to submit a request. Please be as detailed as possible in your explanation and we'll address it as quick as we can.
We welcome your contributions to this open source visualization with a pull request. Please reach out to Google Cloud support to report an error or suggest an improvement. You can also extend this visualization for your own use case.

### Interested in extending the visualization for your own use case?
### Local development

#### Quickstart Dev Instructions
You must have Node v16 and `yarn` installed.

1. **Install Dependencies.**
#### Install Dependencies

Using yarn, install all dependencies
Call `yarn` to install all dependencies, includes React.

```
yarn
```
```
yarn
```

2. **Make changes to the source code**
#### Build javascript

3. **Compile your code**
Run `yarn build` to bundle the javascript. The resulting minified bundle.js will be in the `dist` directory.

You need to compile your react code, let's run:
```
yarn build
```

```
yarn build
```
#### Local testing and other commands

or
Check package.json for additional commands.

```
bin/build
```
#### Commit title format
Commit titles on `master` branch follow [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) message spec. Your commit title must prefix one of 3 types and an optional `!` with the format `TYPE: commit title goes here`.
* `fix` - a commit of the type fix patches a bug (correlates with PATCH in Semantic Versioning). `fix: Correct number formatting`
* `feat` - a commit of the type feat introduces a new feature (correlates with MINOR in Semantic Versioning). `feat: Add column sorting`
* `chore` - a commit of the type chore does not affect viz functionality (corresponds with no change in Semantic Versioning). `chore: Update build process`
* Append an `!` exclamation point to the type if it is a breaking change. `fix!: ...`

Recommended: Webpack can detect changes and build automatically
#### Release management

```
yarn start
```

Your compiled code can be found in this repo.

4. Run unit tests.

Use either:

```
yarn test
```

Or:

```
bin/test
```

**`radialgauge.js`**: This visualization's minified distribution file.

**`LICENSE`**: Looker's Marketplace content License file.

**`manifest.lkml`**: Looker's external dependencies configuration file. The visualization object is defined here.

**`marketplace.json`**: A JSON file containing information the marketplace installer uses to set up this project.

**`/src`**: This directory will contain all of the visualization's source code.

**`/node_modules`**: The directory where all of the modules of code that your project depends on (npm packages) are automatically installed.

**`README.md`**: This! A text file containing useful reference information about this visualization.

**`yarn.lock`**: [Yarn](https://yarnpkg.com/) is a package manager alternative to npm. This file serves essentially the same purpose as `package-lock.json`, just for a different package management system.

**`.babelrc`**: A configuration file for the Babel jsx -> js compiler.
This repo uses GitHub workflows with [release-please](https://github.com/googleapis/release-please) [action](https://github.com/google-github-actions/release-please-action) to create Github releases, determine versioning, and generate changelogs.
30 changes: 0 additions & 30 deletions radialgauge.js

This file was deleted.

30 changes: 0 additions & 30 deletions radialgauge_v2.js

This file was deleted.

6 changes: 2 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ var webpackConfig = {
contentBase: './dist',
},
output: {
filename: '[name]_v2.js',
path: __dirname,
library: '[name]',
libraryTarget: 'umd',
filename: 'bundle.js',
path: path.join(__dirname,'/dist'),
},
resolve: {
extensions: ['.js'],
Expand Down

0 comments on commit 0ed2efb

Please sign in to comment.