Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding automatic image building and release management #69

Merged
merged 15 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 18 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Pull Request
on:
pull_request

jobs:
build_image:
name: Build Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Push Docker Image to Github Registry
EngHabu marked this conversation as resolved.
Show resolved Hide resolved
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
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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 }}
EngHabu marked this conversation as resolved.
Show resolved Hide resolved
GIT_AUTHOR_NAME: "service-github-lyft-semantic-release"
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_COMMITTER_NAME: "service-github-lyft-semantic-release"
GIT_COMMITTER_EMAIL: "[email protected]"
run: npx semantic-release
EngHabu marked this conversation as resolved.
Show resolved Hide resolved
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_image:
name: Build Image for Tag
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: ${{ needs.check_for_tag.outputs.currentTag }}
push_git_tag: true
registry: docker.pkg.github.com
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
Loading