-
Notifications
You must be signed in to change notification settings - Fork 341
135 lines (135 loc) · 4.5 KB
/
test-deploy.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
133
134
135
name: Test & Deploy
on:
pull_request_target:
workflow_dispatch:
workflow_call:
inputs:
release:
required: true
type: boolean
schedule:
- cron: '0 8 * * 1' # M H d m w (Mondays at 8:00)
jobs:
authorize:
environment:
${{ (github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository) &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: echo ✓
check-lock:
needs: authorize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: npm lock file is v2
run: jq --exit-status .lockfileVersion==2 < package-lock.json
lint:
needs: authorize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run lint
test:
needs: authorize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: |
pip install tensorboard
pip install -I protobuf==3.20.1
- run: npm ci && npm install --global
- run: npm run test
env:
GITHUB_TOKEN: ${{ github.token }}
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
TEST_GITHUB_REPO: https://github.com/iterative/cml_qa_tests_dummy
TEST_GITHUB_SHA: 0cd16da26e35f8e5d57b2549a97e22618abf08f6
TEST_GITHUB_ISSUE: 1
TEST_GITLAB_TOKEN: ${{ secrets.TEST_GITLAB_TOKEN }}
TEST_GITLAB_REPO: https://gitlab.com/iterative.ai/cml_qa_tests_dummy
TEST_GITLAB_SHA: f8b8b49a253243830ef59a7f090eb887157b2b67
TEST_GITLAB_ISSUE: 1
TEST_BITBUCKET_TOKEN: ${{ secrets.TEST_BITBUCKET_TOKEN }}
TEST_BITBUCKET_REPO: https://bitbucket.org/iterative-ai/cml-qa-tests-dummy
TEST_BITBUCKET_SHA: b511535a89f76d3d311b1c15e3e712b15c0b94e3
TEST_BITBUCKET_ISSUE: 1
test-os:
needs: authorize
name: test-${{ matrix.system }}
strategy:
matrix:
system: [ubuntu, macos, windows]
runs-on: ${{ matrix.system }}-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- if: matrix.system == 'windows'
uses: actions/setup-node@v3
- name: install
shell: bash
run: |
# https://github.com/npm/npm/issues/18503#issuecomment-347579469
npm pack && npm install -g --no-save ./*cml*.tgz
for cmd in '' runner publish pr; do
cml $cmd --version
done
- if: matrix.system != 'windows'
run: |
for cmd in runner publish pr; do
cml-$cmd --version
done
packages:
needs: [lint, test, test-os]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org
- run: npm install
- run: |
VERSION=$(jq -r .version < package.json)
npm install --dry-run @dvcorg/cml@$VERSION ||
npm ${{ inputs.release && 'publish' || 'publish --dry-run' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Step required "thanks" to https://github.com/actions/runner-images/issues/6283
- uses: Homebrew/actions/setup-homebrew@3040c87fbdd10e6ec48d90bd23cb0abb6d66152d
- run: brew install ldid
- run: |
cp node_modules/@npcz/magic/dist/magic.mgc assets/magic.mgc
npx --yes pkg --no-bytecode --public-packages "*" --public package.json
for cmd in '' runner publish pr; do build/cml-linux-x64 $cmd --version; done
cp build/cml-linux{-x64,}
cp build/cml-macos{-x64,}
- if: inputs.release
run:
find build -type f | xargs gh release upload
"${GITHUB_HEAD_REF#bump/}"
env:
GITHUB_TOKEN: ${{ github.token }}
images:
needs: packages
secrets: inherit
uses: ./.github/workflows/images.yml
with:
release: ${{ inputs.release || false }}