Skip to content

Build oneflow-nightly #9284

Build oneflow-nightly

Build oneflow-nightly #9284

name: Build oneflow-nightly
on:
schedule:
- cron: "0 */2 * * *"
release:
types: [created]
workflow_dispatch:
push:
branches:
- "main"
paths:
- ".github/workflows/oneflow-nightly.yml"
- "oneflow/**"
concurrency:
group: oneflow-nightly-${{ github.ref }}
cancel-in-progress: true
# Environment variables available to all jobs and steps in this workflow.
env:
REGION_ID: cn-beijing
REGISTRY: registry.cn-beijing.aliyuncs.com
NAMESPACE: oneflow
jobs:
build-oneflow-nightly:
name: "Nightly ${{ matrix.tag-suffix }} "
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
include:
- tag-suffix: "cuda11.8"
CUDA_VERSION: "11.8"
ONEFLOW_PIP_INDEX: https://oneflow-staging.oss-cn-beijing.aliyuncs.com/branch/master/cu118
- tag-suffix: "cuda12.1"
CUDA_VERSION: "12.1"
ONEFLOW_PIP_INDEX: https://oneflow-staging.oss-cn-beijing.aliyuncs.com/branch/master/cu121
env:
IMAGE: oneflow
TAG: nightly-${{ matrix.tag-suffix }}
DOCKER_BUILDKIT: 1
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
overprovision-lvm: "true"
- name: Checkout
uses: actions/checkout@v2
# 1.1 Login to ACR
- name: Login to ACR with the AccessKey pair
uses: aliyun/acr-login@v1
with:
login-server: https://registry.${{env.REGION_ID}}.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# 1.2 Buid and push image to ACR
- name: Set env
run: |
curl "${{ matrix.ONEFLOW_PIP_INDEX }}"
DEV_VERSION=$(curl -s ${{ matrix.ONEFLOW_PIP_INDEX }} | grep -oh '[0-9.]*dev[0-9]*' | head -n 1)
echo "DEV_VERSION: ${DEV_VERSION}"
if [ -z "$DEV_VERSION" ]
then
exit 1
fi
echo ONEFLOW_PACKAGE_NAME="oneflow==${DEV_VERSION}" >> $GITHUB_ENV
echo ACR_TAG="$REGISTRY/$NAMESPACE/$IMAGE:$TAG" >> $GITHUB_ENV
echo DOCKERHUB_TAG="oneflowinc/$IMAGE:$TAG" >> $GITHUB_ENV
echo DOCKERHUB_DEV_VERSION_TAG="oneflowinc/$IMAGE:$DEV_VERSION-${{ matrix.tag-suffix }}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: |
${{ env.DOCKERHUB_TAG }}
${{ env.DOCKERHUB_DEV_VERSION_TAG }}
${{ env.ACR_TAG }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_TAG }}
cache-to: type=inline
target: official
build-args: |
CUDA_VERSION=${{matrix.CUDA_VERSION}}
ONEFLOW_PIP_INDEX=${{matrix.ONEFLOW_PIP_INDEX}}
ONEFLOW_PACKAGE_NAME=${{env.ONEFLOW_PACKAGE_NAME}}
context: oneflow
- name: Push image to ACR
run: |
docker push "${{ env.ACR_TAG }}"