Skip to content

Commit

Permalink
Separate workflows (#997)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
0x2b3bfa0 authored Sep 12, 2022
1 parent ca1ed99 commit cce3788
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 300 deletions.
182 changes: 0 additions & 182 deletions .github/workflows/checkbot.yml

This file was deleted.

116 changes: 116 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
on:
workflow_call:
inputs:
test:
required: false
type: boolean
jobs:
images:
runs-on: ubuntu-latest
strategy:
matrix:
dvc: [1, 2]
base: [0, 1]
gpu: [false, true]
include:
- base: 0
ubuntu: 18.04
python: 2.7
cuda: 10.1
cudnn: 7
- base: 1
ubuntu: 20.04
python: 3.8
cuda: 11.2.1
cudnn: 8
- latest: true # update the values below after introducing a new major version
base: 1
dvc: 2
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
fetch-depth: 0
- name: Metadata
id: metadata
run: |
latest_tag=$(git describe --tags | cut -d- -f1)
cml_version=${latest_tag##v}
dvc_version=$(python3 -c '
from distutils.version import StrictVersion as Ver
from urllib.request import urlopen
from json import load
data = load(urlopen("https://pypi.org/pypi/dvc/json"))
ver_pre = "${{ matrix.dvc }}".rstrip(".") + "."
print(
max(
(i.strip() for i in data["releases"] if i.startswith(ver_pre)),
default="${{ matrix.dvc }}",
key=Ver
)
)')
echo ::set-output name=cache_tag::${cml_version}-${dvc_version}-${{ matrix.base }}-${{ matrix.gpu }}
echo ::set-output name=cml_version::$cml_version
tag=${cml_version//.*/}-dvc${{ matrix.dvc }}-base${{ matrix.base }}
if [[ ${{ matrix.gpu }} == true ]]; then
echo ::set-output name=base::nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }}
tag=${tag}-gpu
else
echo ::set-output name=base::ubuntu:${{ matrix.ubuntu }}
fi
TAGS="$(
for registry in docker.io/{dvcorg,iterativeai} ghcr.io/iterative; do
if [[ "${{ matrix.latest }}" == "true" ]]; then
if [[ "${{ matrix.gpu }}" == "true" ]]; then
echo "${registry}/cml:latest-gpu"
else
echo "${registry}/cml:latest"
fi
fi
echo "${registry}/cml:${tag}"
done | head -c-1
)"
echo ::set-output name=tags::"${TAGS//$'\n'/'%0A'}"
- uses: docker/setup-buildx-action@v1
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key:
${{ runner.os }}-buildx-${{ steps.metadata.outputs.cache_tag }}-${{
github.sha }}
restore-keys:
${{ runner.os }}-buildx-${{ steps.metadata.outputs.cache_tag }}-
- uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- uses: docker/build-push-action@v2
with:
push:
${{ github.event_name == 'push' || github.event_name == 'schedule'
|| github.event_name == 'workflow_dispatch' }}
context: ./
file: ./Dockerfile
tags: |
${{ steps.metadata.outputs.tags }}
build-args: |
CML_VERSION=${{ steps.metadata.outputs.cml_version }}
DVC_VERSION=${{ matrix.dvc }}
PYTHON_VERSION=${{ matrix.python }}
BASE_IMAGE=${{ steps.metadata.outputs.base }}
pull: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
workflow_dispatch:
inputs:
bump:
type: choice
required: true
description: Bump version number
options: [major, minor, patch]
default: patch
pull_request:
types: [closed]
jobs:
bump:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git config --global user.name Olivaw[bot]
git config --global user.email [email protected]
git checkout -b bump/$(npm version ${{ github.event.inputs.bump }})
git push --set-upstream origin --follow-tags HEAD
gh pr create --title "Bump version to $(git describe --tags)" --body "Approve me 🤖"
gh pr merge --squash --auto
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
release:
if: github.event.pull_request.merged && startsWith(github.head_ref, 'bump/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run:
gh release create --generate-notes {--title=CML\ ,}$(basename ${{
github.head_ref }})
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
Loading

0 comments on commit cce3788

Please sign in to comment.