Skip to content

Commit

Permalink
Migrate from CircleCI to GitHub Actions (#134)
Browse files Browse the repository at this point in the history
* add support for gh actions

* fix linting issues
  • Loading branch information
simskij authored Oct 15, 2020
1 parent a38e4d3 commit dd7c60c
Show file tree
Hide file tree
Showing 73 changed files with 615 additions and 302 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@
{
"ignore": [
"components",
"hooks",
"images",
"layouts",
"pages",
"templates",
"styles",
"svg",
"templates",
"utils"
]
}
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Production

on:
push:
tags:
- v*

env:
ALGOLIA_ADMIN_KEY: ${{ secrets.PROD_CI_ALGOLIA_ADMIN_KEY })
AWS_ACCESS_KEY_ID: ${{ secrets.PROD_CI_AWS_ACCESS_KEY }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: $({ secrets.PROD_CI_AWS_CLOUDFRONT_DISTRIBUTION_ID})
AWS_REGION: 'eu-west-1'
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROD_CI_AWS_SECRET_KEY }}
BUCKET_NAME: $({ secrets.PROD_CI_BUCKET_NAME })
BUCKET_REGION: $({ secrets.PROD_CI_BUCKET_REGION })
GATSBY_ALGOLIA_APP_ID: $({ secrets.PROD_CI_GATSBY_ALGOLIA_APP_ID })
GATSBY_ALGOLIA_INDEX_NAME: $({ secrets.PROD_CI_GATSBY_ALGOLIA_INDEX_NAME })
GATSBY_ALGOLIA_SEARCH_ONLY_KEY: $({ secrets.PROD_CI_GATSBY_ALGOLIA_SEARCH_ONLY_KEY })
GATSBY_DEFAULT_APP_URL: https://app.$({ secrets.PROD_CI_MAIN_URL })
GATSBY_DEFAULT_BLOG_URL: https://$({ secrets.PROD_CI_MAIN_URL })/blog
GATSBY_DEFAULT_DOC_URL: https://$({ secrets.PROD_CI_MAIN_URL })/docs
GATSBY_DEFAULT_MAIN_URL: https://$({ secrets.PROD_CI_MAIN_URL })
GATSBY_DRIFT_API: $({ secrets.PROD_CI_GATSBY_DRIFT_API })
GATSBY_GOOGLE_API_KEY: $({ secrets.PROD_CI_GATSBY_GOOGLE_API_KEY })

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 12.xs
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Run linter
run: |
npm run lint
npm run lint:prose
build:
runs-on: ubuntu-latest
needs:
- lint
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 12.xs
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: k6-docs
path: public/
deploy-to-production:
runs-on: ubuntu-latest
needs:
- lint
- build
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: k6-docs
path: public/
- name: Install AWS CLI dependencies
run: sudo apt-get update && sudo apt-get -y install python-pip python-dev
- name: Install AWS CLI
run: sudo pip install awscli
- name: Deploy
run: npm run deploy
89 changes: 89 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Staging

on:
push:
branches:
- master

env:
ALGOLIA_ADMIN_KEY: ${{ secrets.STAGING_CI_ALGOLIA_ADMIN_KEY })
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_CI_AWS_ACCESS_KEY }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: $({ secrets.STAGING_CI_AWS_CLOUDFRONT_DISTRIBUTION_ID})
AWS_REGION: 'eu-west-1'
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_CI_AWS_SECRET_KEY }}
BUCKET_NAME: $({ secrets.STAGING_CI_BUCKET_NAME })
BUCKET_REGION: $({ secrets.STAGING_CI_BUCKET_REGION })
GATSBY_ALGOLIA_APP_ID: $({ secrets.STAGING_CI_GATSBY_ALGOLIA_APP_ID })
GATSBY_ALGOLIA_INDEX_NAME: $({ secrets.STAGING_CI_GATSBY_ALGOLIA_INDEX_NAME })
GATSBY_ALGOLIA_SEARCH_ONLY_KEY: $({ secrets.STAGING_CI_GATSBY_ALGOLIA_SEARCH_ONLY_KEY })
GATSBY_DEFAULT_APP_URL: https://app.$({ secrets.STAGING_CI_MAIN_URL })
GATSBY_DEFAULT_BLOG_URL: https://$({ secrets.STAGING_CI_MAIN_URL })/blog
GATSBY_DEFAULT_DOC_URL: https://$({ secrets.STAGING_CI_MAIN_URL })/docs
GATSBY_DEFAULT_MAIN_URL: https://$({ secrets.STAGING_CI_MAIN_URL })
GATSBY_DRIFT_API: $({ secrets.STAGING_CI_GATSBY_DRIFT_API })
GATSBY_GOOGLE_API_KEY: $({ secrets.STAGING_CI_GATSBY_GOOGLE_API_KEY })
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 12.xs
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Run linter
run: |
npm run lint
npm run lint:prose
build:
runs-on: ubuntu-latest
needs:
- lint
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 12.xs
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: k6-docs
path: public/
deploy-to-staging:
runs-on: ubuntu-latest
needs:
- lint
- build
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: k6-docs
path: public/
- name: Install AWS CLI dependencies
run: sudo apt-get update && sudo apt-get -y install python-pip python-dev
- name: Install AWS CLI
run: sudo pip install awscli
- name: Deploy
run: npm run deploy
7 changes: 2 additions & 5 deletions src/components/blocks/cta/cta.view.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';

import { Heading } from 'components/shared/heading';
import { Button } from 'components/shared/button';
import { navigate } from 'gatsby';
import React from 'react';

import styles from './cta.module.scss';

import ButtonBg from './svg/button-bg.inline.svg';

export const CTA = ({
Expand All @@ -16,7 +13,6 @@ export const CTA = ({
buttonRef,
buttonTarget,
openDrift,
openDriftMessage,
themeLight,
}) => (
<section className={styles.wrapper}>
Expand All @@ -32,6 +28,7 @@ export const CTA = ({

<div className={styles.buttonWrapper}>
{themeLight && <ButtonBg className={styles.buttonBg} />}
{/* eslint-disable-next-line no-nested-ternary */}
{openDrift ? (
<Button
className={styles.ctaButton}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import Img from 'gatsby-image';
import styles from './featured-post-card.module.scss';
import classNames from 'classnames';
import { format } from 'date-fns';
import { Button } from 'components/shared/button';
import { Heading } from 'components/shared/heading';
import { format } from 'date-fns';
import Img from 'gatsby-image';
import React from 'react';
import { trimToLengthWithEllipsis } from 'utils';

import styles from './featured-post-card.module.scss';

export const FeaturedPostCard = ({
gatsbyImageData,
covertext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import classNames from 'classnames';
import React from 'react';

import styles from './footer-column.module.scss';

const getClassNames = docLayout =>
const getClassNames = (docLayout) =>
classNames(
{ 'col-lg-3': !!docLayout },
{ 'col-md-3': !docLayout },
Expand All @@ -16,7 +16,7 @@ export const FooterColumn = ({ title, items, docLayout }) => {
<div className={`${getClassNames(docLayout)}`}>
<h3 className={styles.navColumnTitle}>{title}</h3>
<ul className={styles.navColumnList}>
{items.map(item => (
{items.map((item) => (
<li className={styles.navColumnItem}>
<a className={styles.navColumnLink} href={`${item.url}`}>
{item.title}
Expand Down
3 changes: 1 addition & 2 deletions src/components/blocks/footer/footer.view.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link } from 'gatsby';
import React from 'react';
import Logo from 'svg/logo.inline.svg';
import { blog, main, docs } from 'utils/urls';

import styles from './footer.module.scss';
import GithubLogo from './svg/github.inline.svg';
Expand All @@ -9,8 +10,6 @@ import TwitterLogo from './svg/twitter.inline.svg';

import './footer.scss';

import { blog, main, docs } from 'utils/urls';

export const Footer = () => (
<footer className={styles.wrapper}>
<div className={styles.topSection}>
Expand Down
3 changes: 1 addition & 2 deletions src/components/blocks/header/burger/header-burger.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';

import styles from './header-burger.module.scss';


export const Burger = ({ onClick }) => (
<button className={styles.wrapper} type={'button'} onClick={onClick}/>
<button className={styles.wrapper} type={'button'} onClick={onClick} />
);
4 changes: 1 addition & 3 deletions src/components/blocks/header/header.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import styles from './header.module.scss';
export const Header = ({ children }) => (
<header className={styles.wrapper}>
<div className={'container'}>
<div className={'row align-items-center'}>
{children}
</div>
<div className={'row align-items-center'}>{children}</div>
</div>
</header>
);
8 changes: 4 additions & 4 deletions src/components/blocks/header/logo/header-logo.view.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import { Link } from 'gatsby';
import React from 'react';
import Logo from 'svg/logo.inline.svg';
import { main } from 'utils/urls';

import styles from './header-logo.module.scss';

import { main } from 'utils/urls';

export const HeaderLogo = ({ disableLink = false, theme = 'default' }) => {
if (disableLink) {
return <Logo className={styles.logo} />;
} else if (theme === 'doc') {
}
if (theme === 'doc') {
return (
<Link className={`${styles.wrapper} ${styles.wrapper_doc}`} to={`/`}>
<Logo className={styles.logo} />
Expand Down
7 changes: 4 additions & 3 deletions src/components/blocks/html-content/html-content.view.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useRef } from 'react';
import styles from './html-content.module.scss';
import './html-content.scss';
import { MDXRenderer } from 'gatsby-plugin-mdx';
import { MDXProvider } from '@mdx-js/react';
import { MDXRenderer } from 'gatsby-plugin-mdx';
import { useElementsReplacement } from 'hooks';
import React, { useRef } from 'react';

import styles from './html-content.module.scss';

export const HtmlContent = ({
content,
Expand Down
5 changes: 3 additions & 2 deletions src/components/blocks/item-cards-row/item-cards-row.view.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as React from 'react';
import Img from 'gatsby-image';
import classNames from 'classnames';
import { Heading } from 'components/shared/heading';
import {
ItemCard,
styles as itemCardStyles,
} from 'components/shared/item-card';
import Img from 'gatsby-image';
import * as React from 'react';

import styles from './item-cards-row.module.scss';

export const ItemCardsRow = ({ blockTitle, cardsData, label }) => (
Expand Down
21 changes: 12 additions & 9 deletions src/components/blocks/page-info/page-info.view.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Heading } from 'components/shared/heading';
import { Button } from 'components/shared/button';
import { Heading } from 'components/shared/heading';
import { HeroFrame } from 'components/shared/hero-frame';
import React from 'react';

import styles from './page-info.module.scss';

Expand All @@ -19,16 +19,19 @@ export const PageInfo = ({
{title}
</Heading>
<p className={styles.description}>{description}</p>
{ buttonText && buttonURL ?
{buttonText && buttonURL ? (
<Button className={styles.button} tag={'link'} to={buttonURL} cursor>
{buttonText}
</Button>
: buttonText && buttonRef &&
<Button className={styles.button} tag={'a'} href={buttonRef} cursor>
{buttonText}
</Button>
}
) : (
buttonText &&
buttonRef && (
<Button className={styles.button} tag={'a'} href={buttonRef} cursor>
{buttonText}
</Button>
)
)}
</div>
<HeroFrame/>
<HeroFrame />
</section>
);
Loading

0 comments on commit dd7c60c

Please sign in to comment.