Skip to content

Commit

Permalink
replace Travis with GitHub Actions workflow (#358)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kremalicious authored Feb 2, 2021
1 parent ab609b9 commit a951f9b
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 67 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# with:
# coverageCommand: npm test
27 changes: 27 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"tabWidth": 2
"tabWidth": 2,
"endOfLine": "auto"
}
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
34 changes: 3 additions & 31 deletions scripts/deploy.sh → scripts/deploy-s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 \
Expand All @@ -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
s3sync $AWS_S3_BUCKET
2 changes: 1 addition & 1 deletion src/components/molecules/PoolTransactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit a951f9b

Please sign in to comment.