Skip to content

Commit cce3788

Browse files
authored
Separate workflows (#997)
* Simplify release process * Separate workflows * Simplify tests * Fix send–comment pipe * Update smoke.yml * Update smoke.yml * Update smoke.yml * Update smoke.yml * Update smoke.yml * Delete smoke.yml
1 parent ca1ed99 commit cce3788

File tree

5 files changed

+162
-300
lines changed

5 files changed

+162
-300
lines changed

.github/workflows/checkbot.yml

Lines changed: 0 additions & 182 deletions
This file was deleted.

.github/workflows/images.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
test:
5+
required: false
6+
type: boolean
7+
jobs:
8+
images:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
dvc: [1, 2]
13+
base: [0, 1]
14+
gpu: [false, true]
15+
include:
16+
- base: 0
17+
ubuntu: 18.04
18+
python: 2.7
19+
cuda: 10.1
20+
cudnn: 7
21+
- base: 1
22+
ubuntu: 20.04
23+
python: 3.8
24+
cuda: 11.2.1
25+
cudnn: 8
26+
- latest: true # update the values below after introducing a new major version
27+
base: 1
28+
dvc: 2
29+
steps:
30+
- uses: actions/checkout@v2
31+
with:
32+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
33+
fetch-depth: 0
34+
- name: Metadata
35+
id: metadata
36+
run: |
37+
latest_tag=$(git describe --tags | cut -d- -f1)
38+
cml_version=${latest_tag##v}
39+
dvc_version=$(python3 -c '
40+
from distutils.version import StrictVersion as Ver
41+
from urllib.request import urlopen
42+
from json import load
43+
data = load(urlopen("https://pypi.org/pypi/dvc/json"))
44+
ver_pre = "${{ matrix.dvc }}".rstrip(".") + "."
45+
print(
46+
max(
47+
(i.strip() for i in data["releases"] if i.startswith(ver_pre)),
48+
default="${{ matrix.dvc }}",
49+
key=Ver
50+
)
51+
)')
52+
echo ::set-output name=cache_tag::${cml_version}-${dvc_version}-${{ matrix.base }}-${{ matrix.gpu }}
53+
echo ::set-output name=cml_version::$cml_version
54+
tag=${cml_version//.*/}-dvc${{ matrix.dvc }}-base${{ matrix.base }}
55+
if [[ ${{ matrix.gpu }} == true ]]; then
56+
echo ::set-output name=base::nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }}
57+
tag=${tag}-gpu
58+
else
59+
echo ::set-output name=base::ubuntu:${{ matrix.ubuntu }}
60+
fi
61+
62+
TAGS="$(
63+
for registry in docker.io/{dvcorg,iterativeai} ghcr.io/iterative; do
64+
if [[ "${{ matrix.latest }}" == "true" ]]; then
65+
if [[ "${{ matrix.gpu }}" == "true" ]]; then
66+
echo "${registry}/cml:latest-gpu"
67+
else
68+
echo "${registry}/cml:latest"
69+
fi
70+
fi
71+
echo "${registry}/cml:${tag}"
72+
done | head -c-1
73+
)"
74+
echo ::set-output name=tags::"${TAGS//$'\n'/'%0A'}"
75+
- uses: docker/setup-buildx-action@v1
76+
- uses: actions/cache@v2
77+
with:
78+
path: /tmp/.buildx-cache
79+
key:
80+
${{ runner.os }}-buildx-${{ steps.metadata.outputs.cache_tag }}-${{
81+
github.sha }}
82+
restore-keys:
83+
${{ runner.os }}-buildx-${{ steps.metadata.outputs.cache_tag }}-
84+
- uses: docker/login-action@v1
85+
with:
86+
registry: docker.io
87+
username: ${{ secrets.DOCKERHUB_USERNAME }}
88+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
89+
- uses: docker/login-action@v1
90+
with:
91+
registry: ghcr.io
92+
username: ${{ github.repository_owner }}
93+
password: ${{ github.token }}
94+
- uses: docker/build-push-action@v2
95+
with:
96+
push:
97+
${{ github.event_name == 'push' || github.event_name == 'schedule'
98+
|| github.event_name == 'workflow_dispatch' }}
99+
context: ./
100+
file: ./Dockerfile
101+
tags: |
102+
${{ steps.metadata.outputs.tags }}
103+
build-args: |
104+
CML_VERSION=${{ steps.metadata.outputs.cml_version }}
105+
DVC_VERSION=${{ matrix.dvc }}
106+
PYTHON_VERSION=${{ matrix.python }}
107+
BASE_IMAGE=${{ steps.metadata.outputs.base }}
108+
pull: true
109+
cache-from: type=local,src=/tmp/.buildx-cache
110+
cache-to: type=local,dest=/tmp/.buildx-cache-new
111+
- name: Move cache
112+
# https://github.com/docker/build-push-action/issues/252
113+
# https://github.com/moby/buildkit/issues/1896
114+
run: |
115+
rm -rf /tmp/.buildx-cache
116+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
bump:
6+
type: choice
7+
required: true
8+
description: Bump version number
9+
options: [major, minor, patch]
10+
default: patch
11+
pull_request:
12+
types: [closed]
13+
jobs:
14+
bump:
15+
if: github.event_name == 'workflow_dispatch'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- run: |
20+
git config --global user.name Olivaw[bot]
21+
git config --global user.email 64868532+iterative-olivaw@users.noreply.github.com
22+
git checkout -b bump/$(npm version ${{ github.event.inputs.bump }})
23+
git push --set-upstream origin --follow-tags HEAD
24+
gh pr create --title "Bump version to $(git describe --tags)" --body "Approve me 🤖"
25+
gh pr merge --squash --auto
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
28+
release:
29+
if: github.event.pull_request.merged && startsWith(github.head_ref, 'bump/')
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- run:
34+
gh release create --generate-notes {--title=CML\ ,}$(basename ${{
35+
github.head_ref }})
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)