-
Notifications
You must be signed in to change notification settings - Fork 59
132 lines (124 loc) · 4.02 KB
/
checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Flyteconsole Checks
on:
workflow_dispatch:
pull_request:
branches:
- master
- devmain
push:
branches:
- master
- devmain
jobs:
extract_branch:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:
- name: Extract branch name
shell: bash
run: echo "::set-output name=branch::$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}})"
id: extract_branch
unit_tests_with_coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# We need history for codecov to work correctly
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
- name: Install deps
run: yarn install --immutable
- name: Run tests and generate coverage
run: make test_unit_codecov
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: .coverage/coverage-final.json
fail_ci_if_error: false
lint_project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: bahmutov/npm-install@v1
- name: Run linter
run: make lint
build_docker_image:
name: Build Flyteconsole Image
uses: flyteorg/flytetools/.github/workflows/publish.yml@master
with:
version: v1
dockerfile: Dockerfile
push: false
repository: ${{ github.repository }}
secrets:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }}
release:
name: Generate Release
if: ${{ (github.event_name != 'pull_request') && (needs.extract_branch.outputs.branch == 'master') }}
needs: [unit_tests_with_coverage, lint_project, build_docker_image, extract_branch]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.16.1
- name: Install dependencies
run: yarn install --immutable
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.FLYTE_BOT_PAT }}
GIT_AUTHOR_NAME: "flyte bot"
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_COMMITTER_NAME: "flyte bot"
GIT_COMMITTER_EMAIL: "[email protected]"
CI: "true"
run: npx [email protected]
check_for_tag:
name: Get Release Tag
needs: release
runs-on: ubuntu-latest
outputs:
currentTag: ${{ steps.setTag.outputs.currentTag }}
steps:
- uses: actions/checkout@v3
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 $CURRENT_TAG
echo "::set-output name=currentTag::$CURRENT_TAG"
push_docker_image:
name: Build & Push FlyteConsole Image
if: ${{ needs.check_for_tag.outputs.currentTag != '' }}
needs: [check_for_tag]
uses: flyteorg/flytetools/.github/workflows/publish.yml@master
with:
before-build: |
TAG=${{ needs.check_for_tag.outputs.currentTag }}
make update_npmversion VERSION=${TAG:1}
dockerfile: Dockerfile
push: true
repository: ${{ github.repository }}
version: ${{ needs.check_for_tag.outputs.currentTag }}
secrets:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }}