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

move fmt to github hosted #3559

Merged
merged 22 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/actions/fmt/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ghcr.io/oneflow-inc/oneflow-fmt:latest
RUN python3 -m pip install black==19.10b0
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
16 changes: 2 additions & 14 deletions .github/actions/fmt/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,5 @@ inputs:
description: 'Placeholder'
default: 'Placeholder'
runs:
using: "composite"
steps:
- name: Check license (please run 'make of_format' if failed)
shell: bash
run: |
python3 ci/check/run_license_format.py -i oneflow -c
- name: Check C++ format (please run 'make of_format' if failed)
shell: bash
run: |
python3 ci/check/run_clang_format.py --clang_format_binary clang-format --source_dir oneflow
- name: Check python format (please run 'make of_format' if failed)
shell: bash
run: |
docker run --rm -v $PWD:$PWD --entrypoint "/bin/sh" cytopia/black@sha256:ea649b81bf6a64aaa34f4abba803da83528135b5d12bed9b485bcabb37480d33 -c "python3 $PWD/ci/check/run_py_format.py --source_dir $PWD"
using: 'docker'
image: 'Dockerfile'
8 changes: 8 additions & 0 deletions .github/actions/fmt/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh -l

set -ex
python3 ci/check/run_license_format.py -i oneflow -c
python3 ci/check/run_clang_format.py --clang_format_binary clang-format --source_dir oneflow
python3 ci/check/run_py_format.py --source_dir $PWD
time=$(date)
echo "::set-output name=time::$time"
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ on:
required: false
jobs:

check_license_and_format:

runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v2
- name: Check license and format (please run 'make of_format' if failed)
uses: ./.github/actions/fmt

build_and_test:

runs-on: [self-hosted, linux, gpu]
Expand All @@ -24,8 +33,6 @@ jobs:
run: |
docker run --rm -v $PWD:/p -w /p busybox chmod -R o+w .
- uses: actions/checkout@v2
- name: Check license and format (please run 'make of_format' if failed)
uses: ./.github/actions/fmt
- name: Setup submodule
uses: ./.github/actions/setup
- name: Build OneFlow
Expand Down
8 changes: 4 additions & 4 deletions ci/build/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ docker build -f $src_dir/docker/package/manylinux/Dockerfile \

cd -

docker run --rm \
-v $tmp_dir:/ci-tmp \
-w $tmp_dir:/ci-tmp busybox rm -rf /ci-tmp/wheelhouse

# build function
function build() {
set -x
docker run --rm \
-v $tmp_dir:/ci-tmp \
-w $tmp_dir:/ci-tmp busybox rm -rf /ci-tmp/wheelhouse
docker run \
$docker_proxy_run_args \
--rm $docker_it \
Expand All @@ -41,6 +40,7 @@ function build() {
"$docker_tag" \
/oneflow-src/docker/package/manylinux/build_wheel.sh \
--python3.6 \
--house-dir /ci-tmp/wheelhouse \
--package-name oneflow${package_appendix} \
$extra_oneflow_cmake_args
}
Expand Down
3 changes: 3 additions & 0 deletions docker/ci/fmt/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM python:3.7
RUN curl https://oneflow-static.oss-cn-beijing.aliyuncs.com/bin/clang-format -o /usr/local/bin/clang-format && chmod +x /usr/local/bin/clang-format
RUN apt update && apt install -y libncurses5
3 changes: 3 additions & 0 deletions docker/ci/fmt/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -ex
cd docker/ci/fmt
docker build -t oneflow-fmt .
9 changes: 5 additions & 4 deletions docker/package/manylinux/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ ONEFLOW_BUILD_DIR=$CACHE_DIR/build-oneflow

function cleanup {
set -x
rm -rf tmp_wheel
rm -rf $ONEFLOW_BUILD_DIR/python_scripts/oneflow/*.so
rm -rf build/bdist.linux-x86_64
rm -rf build/lib
rm -rf tmp_wheel
}

for PY_VER in ${PY_VERS[@]}
Expand All @@ -92,9 +95,7 @@ do
fi
PY_ROOT=/opt/python/${PY_ABI}
PY_BIN=${PY_ROOT}/bin/python
rm -rf $ONEFLOW_BUILD_DIR/python_scripts/oneflow/*.so
rm -rf $ONEFLOW_SRC_DIR/build/bdist.linux-x86_64
rm -rf $ONEFLOW_SRC_DIR/build/lib
cleanup
cmake -DTHIRD_PARTY=OFF -DONEFLOW=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
$COMMON_CMAKE_ARGS \
Expand Down