Skip to content

Commit

Permalink
feat: test npm build&install against LTS node versions (#1967)
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Jul 9, 2022
1 parent 7e91a63 commit 39dc9e9
Show file tree
Hide file tree
Showing 5 changed files with 566 additions and 416 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/node-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Test NodeJS

on:
workflow_call:
inputs:
gh-node-version:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.gh-node-version }}
cancel-in-progress: true

jobs:
reset-badge:
runs-on: ubuntu-latest
steps:
- name: "Reset ${{ inputs.gh-node-version }} badge"
uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7
with:
ICON: https://raw.githubusercontent.com/devicons/devicon/master/icons/nodejs/nodejs-original.svg
NAME: "node-${{ inputs.gh-node-version }}"
LABEL: "${{ inputs.gh-node-version }}"
STATUS: "Building..."
COLOR: grey
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test-node:
needs: [reset-badge]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
outputs:
node-version: ${{ steps.node_version.outputs.version }}
steps:

- uses: actions/checkout@v2

- name: Use Node.js ${{ inputs.gh-node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ inputs.gh-node-version }}

- name: Get exact nodejs version
id: node_version
run: |
echo "::set-output name=version::$(node --version)"
- name: Cache bigger downloads
uses: actions/cache@v2
id: cache
with:
path: ${{ github.workspace }}/.cache
key: ${{ runner.os }}-${{ inputs.gh-node-version }}-${{ hashFiles('package.json', 'package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ inputs.gh-node-version }}-${{ hashFiles('package.json', 'package-lock.json') }}
${{ runner.os }}-${{ inputs.gh-node-version }}
- name: Install dependencies
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm

- name: Confirm build works with Node.js ${{ inputs.gh-node-version }} on ${{ matrix.os }}
run: npm run build

create-badges:
needs: [test-node]
runs-on: ubuntu-latest
if: always()
steps:
- name: Create success badge
if: ${{ needs.test-node.result == 'success' }}
uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7
with:
ICON: https://raw.githubusercontent.com/devicons/devicon/master/icons/nodejs/nodejs-original.svg
NAME: "node-${{ inputs.gh-node-version }}"
LABEL: "${{ needs.test-node.outputs.node-version }}"
STATUS: ${{needs.test-node.result}}
COLOR: green
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create failure badge
if: ${{ needs.test-node.result != 'success' }}
uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7
with:
ICON: https://raw.githubusercontent.com/devicons/devicon/master/icons/nodejs/nodejs-original.svg
NAME: "node-${{ inputs.gh-node-version }}"
LABEL: "${{ needs.test-node.outputs.node-version }}"
STATUS: ${{needs.test-node.result}}
COLOR: red
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/node-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test build on different node versions on all platforms

on:
schedule:
- cron: '0 12 * * 0'

workflow_dispatch:

jobs:

test-node-12:
uses: ./.github/workflows/node-test.yml
secrets: inherit
with:
gh-node-version: '12.x'

test-node-14:
uses: ./.github/workflows/node-test.yml
secrets: inherit
with:
gh-node-version: '14.x'

test-node-16:
uses: ./.github/workflows/node-test.yml
secrets: inherit
with:
gh-node-version: '16.x'

test-node-lts:
uses: ./.github/workflows/node-test.yml
secrets: inherit
with:
gh-node-version: 'lts/*'
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

| Files | Explore | Peers | Settings |
|-------|---------|-------|----------|
| ![Screenshot of the file browser page](docs/screenshots/ipfs-webui-files.png) | ![Screenshot of the IPLD explorer page](docs/screenshots/ipfs-webui-explore.png) | ![Screenshot of the swarm peers map](docs/screenshots/ipfs-webui-peers.png) | ![Screenshot of the settings page](docs/screenshots/ipfs-webui-settings.png) |
| ![Screenshot of the file browser page](docs/screenshots/ipfs-webui-files.png) | ![Screenshot of the IPLD explorer page](docs/screenshots/ipfs-webui-explore.png) | ![Screenshot of the swarm peers map](docs/screenshots/ipfs-webui-peers.png) | ![Screenshot of the settings page](docs/screenshots/ipfs-webui-settings.png) |

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg)](https://protocol.ai/) [![](https://img.shields.io/github/release/ipfs/ipfs-webui.svg)](https://github.com/ipfs/ipfs-webui/releases/latest) [![i18n status](https://img.shields.io/badge/i18n-translated-blue.svg)](https://www.transifex.com/ipfs/ipfs-webui/) [![](https://img.shields.io/badge/matrix%20chat-%23lobby:ipfs.io-blue.svg?style=flat-square)](https://matrix.to/#/#lobby:ipfs.io)

Expand All @@ -22,7 +22,7 @@ The app is built with [`create-react-app`](https://github.com/facebook/create-re

## Install

With `node` >= 10 and `npm` >= 6.4.1 installed, run
With a supported Node.js version: [![](https://byob.yarr.is/SgtPooki/ipfs-webui/node-10.x)](https://github.com/SgtPooki/ipfs-webui/actions/workflows/node-versions.yml) [![](https://byob.yarr.is/SgtPooki/ipfs-webui/node-12.x)](https://github.com/SgtPooki/ipfs-webui/actions/workflows/node-versions.yml) [![](https://byob.yarr.is/SgtPooki/ipfs-webui/node-14.x)](https://github.com/SgtPooki/ipfs-webui/actions/workflows/node-versions.yml) [![](https://byob.yarr.is/SgtPooki/ipfs-webui/node-16.x)](https://github.com/SgtPooki/ipfs-webui/actions/workflows/node-versions.yml) [![](https://byob.yarr.is/SgtPooki/ipfs-webui/node-18.x)](https://github.com/SgtPooki/ipfs-webui/actions/workflows/node-versions.yml)

```sh
> npm install
Expand Down Expand Up @@ -157,7 +157,7 @@ CI setup of ipfs-webui repo runs tests against both JS and GO implementations:

It is possible to test against arbitrary versions by tweaking `ipfs` (js-ipfs)
and `go-ipfs` in `devDependencies` section of `package.json` and applying the change via `npm i`

One can also override the binary used in e2e tests by providing a path to an alternative one via `IPFS_GO_EXEC` (or `IPFS_JS_EXEC`):

```sh
Expand Down Expand Up @@ -268,10 +268,10 @@ You can read more on how we use Transifex and i18next in this app at [`docs/LOCA
1. Update the version (`npm version [major|minor|patch]`, it will create a new tag `vN.N.N`, note it down)
1. Push `main` branch and the `vN.N.N` tag to GitHub: `git push && git push origin vN.N.N`
1. Wait for `vN.N.N` to [build on CI](https://github.com/ipfs/ipfs-webui/actions), and grab the CID produced from the tagged commit
1. Add release notes to https://github.com/ipfs/ipfs-webui/releases, use the tag and CID you created
1. Add release notes to https://github.com/ipfs/ipfs-webui/releases, use the tag and CID you created
1. If release is good enough for LTS, update the CID at projects that use ipfs-webui by submitting PR against below lines:
- ~js-ipfs: https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs-http-server/src/api/routes/webui.js#L5~
- currently blocked by https://github.com/ipfs/ipfs-webui/issues/1730
- currently blocked by https://github.com/ipfs/ipfs-webui/issues/1730
- go-ipfs: https://github.com/ipfs/go-ipfs/blob/master/core/corehttp/webui.go#L4
- ipfs-desktop: https://github.com/ipfs/ipfs-desktop/blob/master/package.json#L18

Expand Down
Loading

0 comments on commit 39dc9e9

Please sign in to comment.