Make sponsorships searchable by id #2510
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint, build and test | |
on: [push] | |
jobs: | |
linting: | |
name: eslint, stylelint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
# common steps | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
# job specific steps | |
- name: Run ESlint | |
run: npm run eslint | |
- name: Run Stylelint | |
run: npm run stylelint | |
- name: Hadolint for linting Dockerfile | |
uses: hadolint/hadolint-action@v3.1.0 | |
with: | |
dockerfile: ./Dockerfile | |
config: ./.hadolint.yaml | |
jestSetup: | |
name: 'Set up jest chunks' | |
runs-on: ubuntu-latest | |
outputs: | |
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} | |
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: npm ci | |
- id: set-test-chunks | |
name: Set Chunks | |
run: echo "test-chunks=$(npx jest --listTests --json | jq -cM '[_nwise(length / 5 | ceil)]')" >> $GITHUB_OUTPUT | |
- id: set-test-chunk-ids | |
name: Set Chunk IDs | |
run: echo "test-chunk-ids=$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')" >> $GITHUB_OUTPUT | |
env: | |
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} | |
jest: | |
name: Jest Tests (chunk ${{ matrix.chunk }}) | |
runs-on: ubuntu-latest | |
needs: | |
- jestSetup | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [16.x] | |
chunk: ${{ fromJson(needs.jestSetup.outputs['test-chunk-ids']) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Start Streamr Docker Stack | |
uses: streamr-dev/streamr-docker-dev-action@v1.0.1 | |
with: | |
services-to-start: "mysql cassandra parity-node0 parity-sidechain-node0 broker-node-storage-1 nginx" | |
- name: Run Jest Tests | |
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs npx jest --verbose --useStderr --forceExit --coverage=false --logHeapUsage --runInBand | |
env: | |
CHUNKS: ${{ needs.jestSetup.outputs['test-chunks'] }} | |
TEST_HOOKS: 1 | |
cypress: | |
# It takes time and often fails. @todo make it more reliable, then re-enable. | |
if: ${{ false }} | |
name: Cypress Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
# common steps | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Cache Cypress binary | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/Cypress | |
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
cypress-${{ runner.os }}-cypress- | |
# job specific steps | |
- name: Build app | |
run: npm run build | |
- name: Start Streamr Docker Stack | |
uses: streamr-dev/streamr-docker-dev-action@v1.0.1 | |
with: | |
services-to-start: "mysql cassandra parity-node0 parity-sidechain-node0 broker-node-storage-1 nginx" | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v5 | |
with: | |
browser: chrome | |
# Start serving 'dist' folder from previous build step | |
start: npx serve dist --listen 3333 --single | |
wait-on: "http://localhost" | |
wait-on-timeout: 120 | |
- uses: actions/upload-artifact@master | |
with: | |
name: screenshots | |
path: | |
cypress/screenshots | |
chromatic: | |
# It fails and we don't seem to care. Let's skip. | |
if: ${{ false }} | |
name: Chromatic Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Chromatic needs full history | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies | |
run: | | |
npm ci | |
- name: Build Storybook | |
env: | |
NODE_ENV: production | |
PORT: 12345 | |
PLATFORM_PUBLIC_PATH: https://cdn.streamr.com | |
GOOGLE_ANALYTICS_ID: UA-55331565-5 | |
SENTRY_ENVIRONMENT: chromatic | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }} | |
SENTRY_ORG: streamr | |
SENTRY_PROJECT: hub | |
SENTRY_DSN: https://d8374218c009438e961ba15b07c7f893@o151964.ingest.sentry.io/4504950164946944 | |
TEST_HOOKS: off | |
run: npm run build-storybook --output-dir storybook-static | |
- name: Publish storybook to Chromatic | |
uses: chromaui/action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
exitZeroOnChanges: true | |
# Use output folder from previous step | |
storybookBuildDir: storybook-static |