forked from alibaba/BladeDISC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re-add torch bench yml (alibaba#698)
- Loading branch information
1 parent
2c5993e
commit 4578ffe
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Job Reusable Workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
name: | ||
required: true | ||
type: string | ||
base_image: | ||
required: true | ||
type: string | ||
device: | ||
required: true | ||
type: string | ||
timeout_minutes: | ||
required: false | ||
type: number | ||
default: 360 | ||
dockerfile: | ||
required: true | ||
type: string | ||
exec_command: | ||
required: true | ||
type: string | ||
extra_build_args: | ||
required: false | ||
type: string | ||
extra_run_args: | ||
required: false | ||
type: string | ||
extra_envs: | ||
required: false | ||
type: string | ||
push_command: | ||
required: true | ||
type: string | ||
remote_dev_docker: | ||
required: true | ||
type: string | ||
secrets: | ||
ALIYUN_DOCKER_USERNAME: | ||
required: false | ||
ALIYUN_DOCKER_PASSWORD: | ||
required: false | ||
DOCKER_USERNAME: | ||
required: false | ||
DOCKER_PASSWORD: | ||
required: false | ||
OSS_ENDPOINT: | ||
required: false | ||
OSS_AK: | ||
required: false | ||
OSS_SK: | ||
required: false | ||
|
||
jobs: | ||
Job: | ||
if: github.repository == 'alibaba/BladeDISC' | ||
# The type of runner that the job will run on | ||
runs-on: [self-hosted, "${{ inputs.device }}" ] | ||
timeout-minutes: ${{inputs.timeout_minutes}} | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Runs a single command using the runners shell | ||
- name: Checkout | ||
uses: actions/checkout@v2.4.0 | ||
- name: Build Docker | ||
run: | | ||
set -e | ||
git submodule sync | ||
git submodule update --depth=1 --init --recursive | ||
docker build -t disc-dev-${{ inputs.name }} \ | ||
--build-arg BASEIMAGE=${{ inputs.base_image }} \ | ||
${{ inputs.extra_build_args }} \ | ||
${{ inputs.extra_envs }} \ | ||
-f ${{ inputs.dockerfile }} . | ||
- name: Run Job | ||
run: | | ||
set -e | ||
docker run --rm -t --user $(id -u):$(id -g) \ | ||
${{ inputs.extra_run_args }} \ | ||
-v $HOME/.cache:$HOME/.cache \ | ||
-v /etc/passwd:/etc/passwd:ro \ | ||
-v /etc/group:/etc/group:ro \ | ||
-v $PWD:/disc \ | ||
-e GITHUB_WORKFLOW=$GITHUB_WORKFLOW \ | ||
${{ inputs.extra_envs }} \ | ||
-e OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} \ | ||
-e OSS_AK=${{ secrets.OSS_AK }} \ | ||
-e OSS_SK=${{ secrets.OSS_SK }} \ | ||
-w /disc \ | ||
disc-dev-${{ inputs.name }} ${{ inputs.exec_command }} | ||
- name: Push Docker Image | ||
env: | ||
ALIYUN_DOCKER_USERNAME: ${{ secrets.ALIYUN_DOCKER_USERNAME }} | ||
ALIYUN_DOCKER_PASSWORD: ${{ secrets.ALIYUN_DOCKER_PASSWORD }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
GITHUB_PULL_REQUEST: ${{ github.event.number }} | ||
REMOTE_DEV_DOCKER: ${{ inputs.remote_dev_docker }} | ||
LOCAL_DEV_DOCKER: disc-dev-${{ inputs.name }} | ||
run: | | ||
set -e | ||
if [[ ! -z "${{ inputs.push_command }}" ]]; then | ||
echo "Push docker image" | ||
${{ inputs.push_command }} | ||
fi |