Skip to content

Commit

Permalink
feat: Adding automatic image building and release management (#69)
Browse files Browse the repository at this point in the history
* feat: adds workflows for automatic releases

* ci: cleanup

* test: bumping up wait time to eliminate false failures

* ci: update token

* chore: testing release flow

* chore: temporary test branch config

* ci: set proper author/committer names

* ci: set proper bot email addresses

* ci: trying with empty email credentials

* ci: another attempt to correctly identify the bot user

* chore: undo testing hacks

* fix: broken tests after minor/patch dependency upgrades

* ci: update actions to also push to dockerhub

* ci: push latest/SHA tags for master as well

* ci: cleanup and making push jobs parallel
  • Loading branch information
schottra authored Jun 30, 2020
1 parent 07796a8 commit 90362e2
Show file tree
Hide file tree
Showing 12 changed files with 4,712 additions and 1,678 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ insert_final_newline = true
[*.json]
indent_size = 2

[*.yaml]
[*.{yaml,yml}]
indent_size = 2

[*.md]
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pull Request
on: pull_request

jobs:
build_push_github:
name: Build and push to Github
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Push Docker Image to Github Registry
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
image_name: ${{ secrets.package_name }}
image_tag: ${{ github.sha }}
registry: docker.pkg.github.com
build_push_dockerhub:
name: Build and push to Dockerhub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Push Docker Image to Dockerhub
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
image_name: ${{ secrets.DOCKERHUB_IMAGE_NAME }}
image_tag: ${{ github.sha }}
build_extra_args: "--compress=true"
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
push:
branches:
- master
jobs:
release:
name: Generate Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASEBOT_TOKEN }}
GIT_AUTHOR_NAME: "service-github-lyft-semantic-release"
GIT_AUTHOR_EMAIL: "service-github-lyft-semantic-release@users.noreply.github.com"
GIT_COMMITTER_NAME: "service-github-lyft-semantic-release"
GIT_COMMITTER_EMAIL: "service-github-lyft-semantic-release@users.noreply.github.com"
run: npx semantic-release
check_for_tag:
name: Get Release Tag
needs: release
runs-on: ubuntu-latest
outputs:
currentTag: ${{ steps.setTag.outputs.currentTag }}
steps:
- uses: actions/checkout@v2
with:
# Use the latest commit on the branch which triggered this workflow,
# not the commit which triggered the workflow
ref: ${{ github.ref }}
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Get target git ref
id: setTag
# Print any tags associated with the target ref, in reverse lexicographical
# order so that the first item is the highest version number. If we find
# a tag, update our target
run: |
CURRENT_TAG=$(git tag --sort=-refname --points-at ${{ github.ref }} | head -n 1)
echo "::set-output name=currentTag::$CURRENT_TAG"
build_push_github:
name: Build and push image to Github
needs: check_for_tag
runs-on: ubuntu-latest
if: needs.check_for_tag.outputs.currentTag
steps:
- uses: actions/checkout@v2
with:
ref: ${{ needs.check_for_tag.outputs.currentTag }}
- name: Push Docker Image to Github Registry
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
image_name: ${{ secrets.package_name }}
image_tag: latest,${{github.sha}},${{ needs.check_for_tag.outputs.currentTag }}
push_git_tag: true
registry: docker.pkg.github.com
push_dockerhub:
name: Build and push image to Dockerhub
needs: check_for_tag
runs-on: ubuntu-latest
if: needs.check_for_tag.outputs.currentTag
steps:
- uses: actions/checkout@v2
with:
ref: ${{ needs.check_for_tag.outputs.currentTag }}
- name: Push Docker Image to Dockerhub
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
image_name: ${{ secrets.DOCKERHUB_IMAGE_NAME }}
image_tag: latest,${{ github.sha }},${{ needs.check_for_tag.outputs.currentTag }}
push_git_tag: true
build_extra_args: "--compress=true"
4 changes: 4 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ overrides:
- files: "*.json"
options:
tabWidth: 2
- files: ["*.yml", "*.yaml"]
options:
singleQuote: false
tabWidth: 2
21 changes: 21 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
}
],
["@semantic-release/npm", { "npmPublish": false }],
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": ["package.json", "CHANGELOG.md"],
"message": "chore(release): Release ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.6.0](http://github.com/lyft/flyteconsole/compare/v0.5.2...v0.6.0) (2020-05-13)


### Bug Fixes

* adds proper plugin to update package.json when releasing ([8640ac7](http://github.com/lyft/flyteconsole/commit/8640ac7f8e9620aa1484c30d24c50fe7862021ad))


### Features

* testing publishing of a release ([3c77418](http://github.com/lyft/flyteconsole/commit/3c774183c897a17c29481eba65b93a358b62cc8e))

# [0.6.0](http://github.com/lyft/flyteconsole/compare/v0.5.2...v0.6.0) (2020-05-13)


### Bug Fixes

* adds proper plugin to update package.json when releasing ([8640ac7](http://github.com/lyft/flyteconsole/commit/8640ac7f8e9620aa1484c30d24c50fe7862021ad))


### Features

* testing publishing of a release ([3c77418](http://github.com/lyft/flyteconsole/commit/3c774183c897a17c29481eba65b93a358b62cc8e))
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flyteconsole",
"version": "0.5.2",
"version": "0.6.0",
"description": "The web UI for the Flyte platform",
"repository": {
"type": "git",
Expand All @@ -17,13 +17,18 @@
"lint:hooks": "eslint \"src/**/*.{ts,tsx}\"",
"mockApi": "node ./mockApi",
"prebuild": "yarn run clean",
"precommit": "lint-staged",
"start": "node -r dotenv/config index.js",
"storybook": "start-storybook -p 9001 -c .storybook",
"tdd": "yarn run test --watch --verbose false",
"test": "NODE_ENV=test jest --config=jest.config.js",
"test-coverage": "NODE_ENV=test jest --coverage --config=jest.config.js"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"keywords": [
"react",
"lyft"
Expand Down Expand Up @@ -70,11 +75,19 @@
"@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@date-io/moment": "1.3.9",
"@lyft/flyteidl": "^0.17.27",
"@material-ui/core": "^4.0.0",
"@material-ui/icons": "^4.0.0",
"@material-ui/pickers": "^3.2.2",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.0.5",
"@semantic-release/npm": "^7.0.5",
"@semantic-release/release-notes-generator": "^9.0.1",
"@storybook/addon-actions": "5.1.10",
"@storybook/addon-knobs": "5.1.10",
"@storybook/react": "5.3.12",
Expand Down Expand Up @@ -143,7 +156,7 @@
"fork-ts-checker-webpack-plugin": "^4.0.3",
"html-webpack-externals-plugin": "^3.7.0",
"html-webpack-plugin": "^3.2.0",
"husky": "^0.14.3",
"husky": "^4.2.5",
"identity-obj-proxy": "^3.0.0",
"intersection-observer": "^0.7.0",
"jest": "^25.5.0",
Expand All @@ -168,6 +181,7 @@
"react-test-renderer": "^16.9.0",
"react-virtualized": "^9.21.1",
"resolve-url-loader": "^2.3.0",
"semantic-release": "^17.0.7",
"shallowequal": "^1.1.0",
"snakecase-keys": "^3.1.0",
"source-map-loader": "^0.2.1",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Executions/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('getWorkflowExecutionTimingMS', () => {
expect(firstResult).not.toBeNull();

// Force a tick so new Date() will return a different value
await waitFor(0);
await waitFor(10);
const secondResult = getWorkflowExecutionTimingMS(execution);
expect(secondResult).not.toBeNull();
expect(firstResult!.duration).toBeLessThan(secondResult!.duration);
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('getNodeExecutionTimingMS', () => {
expect(firstResult).not.toBeNull();

// Force a tick so new Date() will return a different value
await waitFor(0);
await waitFor(10);
const secondResult = getNodeExecutionTimingMS(execution);
expect(secondResult).not.toBeNull();
expect(firstResult!.duration).toBeLessThan(secondResult!.duration);
Expand Down Expand Up @@ -174,7 +174,7 @@ describe('getTaskExecutionTimingMS', () => {
expect(firstResult).not.toBeNull();

// Force a tick so new Date() will return a different value
await waitFor(0);
await waitFor(10);
const secondResult = getTaskExecutionTimingMS(execution);
expect(secondResult).not.toBeNull();
expect(firstResult!.duration).toBeLessThan(secondResult!.duration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Array [
</p>
</header>,
<header
className="makeStyles-container-33"
className="makeStyles-container-3"
>
<h6
className="MuiTypography-root makeStyles-title-34 MuiTypography-h6"
className="MuiTypography-root makeStyles-title-4 MuiTypography-h6"
>
Workflow Graph
</h6>
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/DropDownWindowButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const DropDownWindowButton: React.FC<DropDownWindowButtonProps> = ({
horizontal: 'right'
}}
>
{showWindow ? renderContent(closeForm) : null}
{showingWindow ? renderContent(closeForm) : null}
</Popover>
</div>
);
Expand Down
Loading

0 comments on commit 90362e2

Please sign in to comment.