Skip to content

Commit 9e8bdf4

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 9e8bdf4

File tree

5 files changed

+155
-293
lines changed

5 files changed

+155
-293
lines changed

.github/workflows/checkbot.yml

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

.github/workflows/images.yml

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

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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)" --fill
25+
env:
26+
GITHUB_TOKEN: ${{ github.token }}
27+
release:
28+
if: github.event.pull_request.merged && startsWith(github.head_ref, 'bump/')
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
- run: gh release create --generate-notes --draft {--target=,--title=CML\ ,}$(basename ${{ github.head_ref }})
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)