mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
replace Travis with GitHub Actions workflow (#358)
* replace Travis with GitHub Actions workflow * fix prettier on Windows * remove PascalCasing bash one-liner for one use case * use mkdirp to workaround Windows * cache tweaks * move s3 deploy to own workflow * upload artifacts for debug * path tweak * debug * apollo:codegen without folder pre-creation * debug: activate s3 deploy for all branches * pass env vars to deployment build * more env var passing * deploy main branch pushes only
This commit is contained in:
parent
ab609b93c0
commit
a951f9bf3b
54
.github/workflows/ci.yml
vendored
Normal file
54
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
name: 'CI'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- '**'
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
node: ['15', '14'] # Latest + LTS
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-${{ matrix.node }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: ${{ runner.os }}-${{ matrix.node }}-build-${{ env.cache-name }}-
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run apollo:codegen
|
||||
- run: npm run lint
|
||||
# - run: npm test
|
||||
- run: npm run build
|
||||
|
||||
# coverage:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: actions/setup-node@v2
|
||||
# - run: npm ci
|
||||
# - uses: paambaati/codeclimate-action@v2.7.5
|
||||
# env:
|
||||
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
# with:
|
||||
# coverageCommand: npm test
|
27
.github/workflows/deploy.yml
vendored
Normal file
27
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
name: 'Deploy'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
s3:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- run: npm ci
|
||||
|
||||
- run: npm run build
|
||||
env:
|
||||
GATSBY_NETWORK: ${{ secrets.GATSBY_NETWORK }}
|
||||
GATSBY_INFURA_PROJECT_ID: ${{ secrets.GATSBY_INFURA_PROJECT_ID }}
|
||||
GATSBY_PORTIS_ID: ${{ secrets.GATSBY_PORTIS_ID }}
|
||||
|
||||
- run: npm run deploy:s3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
|
@ -2,5 +2,6 @@
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"tabWidth": 2
|
||||
"tabWidth": 2,
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
|
31
.travis.yml
31
.travis.yml
@ -1,31 +0,0 @@
|
||||
dist: xenial
|
||||
language: node_js
|
||||
node_js: node
|
||||
|
||||
cache:
|
||||
npm: true
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python3
|
||||
- python3-pip
|
||||
|
||||
before_script:
|
||||
# - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
||||
# - chmod +x ./cc-test-reporter
|
||||
# - './cc-test-reporter before-build'
|
||||
script:
|
||||
# will run `npm ci` automatically here
|
||||
- npm run apollo:codegen
|
||||
- npm run lint
|
||||
# - './cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT'
|
||||
- npm run build
|
||||
|
||||
after_success:
|
||||
- pip3 install --user awscli
|
||||
- export PATH=$PATH:$HOME/.local/bin
|
||||
- npm run deploy
|
||||
|
||||
notifications:
|
||||
email: false
|
@ -2,7 +2,7 @@
|
||||
|
||||
<h1 align="center">Ocean Marketplace</h1>
|
||||
|
||||
[![Build Status](https://travis-ci.com/oceanprotocol/market.svg?token=3psqw6c8KMDqfdGQ2x6d&branch=main)](https://travis-ci.com/oceanprotocol/market)
|
||||
[![Build Status](https://github.com/oceanprotocol/market/workflows/CI/badge.svg)](https://github.com/oceanprotocol/market/actions)
|
||||
[![Netlify Status](https://api.netlify.com/api/v1/badges/c85f4d8b-95e1-4010-95a4-2bacd8b90981/deploy-status)](https://app.netlify.com/sites/market-oceanprotocol/deploys)
|
||||
[![Maintainability](https://api.codeclimate.com/v1/badges/d114f94f75e6efd2ee71/maintainability)](https://codeclimate.com/repos/5e3933869a31771fd800011c/maintainability)
|
||||
[![Test Coverage](https://api.codeclimate.com/v1/badges/d114f94f75e6efd2ee71/test_coverage)](https://codeclimate.com/repos/5e3933869a31771fd800011c/test_coverage)
|
||||
|
@ -18,8 +18,8 @@
|
||||
"storybook": "start-storybook -p 4000 -c .storybook",
|
||||
"storybook:build": "build-storybook -c .storybook -o public/storybook",
|
||||
"write:repoMetadata": "node ./scripts/write-repo-metadata > repo-metadata.json",
|
||||
"deploy": "./scripts/deploy.sh",
|
||||
"apollo:codegen": "mkdir -p src/@types/apollo/ && apollo client:codegen --target typescript --tsFileExtension='d.ts' --outputFlat './src/@types/apollo/' && find ./src/@types/apollo -type f -exec sed -i -r 's/_([a-z])/\\U\\1/gi' {} \\;",
|
||||
"deploy:s3": "./scripts/deploy-s3.sh",
|
||||
"apollo:codegen": "apollo client:codegen --target typescript --tsFileExtension=d.ts --outputFlat src/@types/apollo/",
|
||||
"postinstall": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -5,7 +5,6 @@
|
||||
# AWS_SECRET_ACCESS_KEY
|
||||
# AWS_DEFAULT_REGION us-east-1
|
||||
AWS_S3_BUCKET="www-market"
|
||||
AWS_S3_BUCKET_BETA="www-market-beta"
|
||||
|
||||
#
|
||||
set -e;
|
||||
@ -16,10 +15,10 @@ function s3sync {
|
||||
--exclude "*.html" \
|
||||
--exclude "sw.js" \
|
||||
--exclude "*page-data.json" \
|
||||
--exclude "*app-data.json" \
|
||||
--exclude "chunk-map.json" \
|
||||
--exclude "sitemap.xml" \
|
||||
--exclude ".iconstats.json" \
|
||||
--exclude "humans.txt" \
|
||||
--exclude "robots.txt" \
|
||||
--cache-control public,max-age=31536000,immutable \
|
||||
--delete \
|
||||
@ -30,41 +29,14 @@ function s3sync {
|
||||
--include "*.html" \
|
||||
--include "sw.js" \
|
||||
--include "*page-data.json" \
|
||||
--include "*app-data.json" \
|
||||
--include "chunk-map.json" \
|
||||
--include "sitemap.xml" \
|
||||
--include ".iconstats.json" \
|
||||
--include "humans.txt" \
|
||||
--include "robots.txt" \
|
||||
--cache-control public,max-age=0,must-revalidate \
|
||||
--delete \
|
||||
--acl public-read
|
||||
}
|
||||
|
||||
##
|
||||
## check for pull request against master
|
||||
##
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "main" ]; then
|
||||
|
||||
s3sync $AWS_S3_BUCKET_BETA
|
||||
|
||||
##
|
||||
## check for master push which is no pull request
|
||||
##
|
||||
elif [ "$TRAVIS_BRANCH" == "main" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] || [ "$TRAVIS" != true ]; then
|
||||
|
||||
s3sync $AWS_S3_BUCKET
|
||||
|
||||
|
||||
echo "---------------------------------------------"
|
||||
echo " ✓ done deployment "
|
||||
echo "---------------------------------------------"
|
||||
|
||||
exit;
|
||||
|
||||
else
|
||||
|
||||
echo "---------------------------------------------"
|
||||
echo " nothing to deploy "
|
||||
echo "---------------------------------------------"
|
||||
|
||||
fi
|
@ -11,7 +11,7 @@ import { formatPrice } from '../atoms/Price/PriceUnit'
|
||||
import { gql, useQuery } from '@apollo/client'
|
||||
import {
|
||||
TransactionHistory,
|
||||
TransactionHistoryPoolTransactions
|
||||
TransactionHistory_poolTransactions as TransactionHistoryPoolTransactions
|
||||
} from '../../@types/apollo/TransactionHistory'
|
||||
|
||||
import web3 from 'web3'
|
||||
|
Loading…
Reference in New Issue
Block a user