Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate workflows #997

Merged
merged 12 commits into from
Sep 12, 2022
182 changes: 0 additions & 182 deletions .github/workflows/checkbot.yml

This file was deleted.

117 changes: 117 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
on:
workflow_call:
inputs:
test:
required: false
type: boolean
secrets: inherit
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
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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)" --fill
casperdcl marked this conversation as resolved.
Show resolved Hide resolved
env:
GITHUB_TOKEN: ${{ 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 --draft {--target=,--title=CML\ ,}$(basename ${{ github.head_ref }})
env:
GITHUB_TOKEN: ${{ github.token }}
Loading