Reduce number of test runs.

This commit is contained in:
Fangjun Kuang 2022-06-04 14:00:43 +08:00
parent 9e20cf029f
commit da7fa223d9
11 changed files with 160 additions and 6 deletions

View File

@ -27,7 +27,24 @@ on:
- cron: "50 23 * * *"
jobs:
enable_nightly_build:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.set-enabled.outputs.enabled }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set enabled
id: set-enabled
run: |
enabled=$(python scripts/github_actions/run-nightly-build.py)
echo "enabled: $enabled"
echo "::set-output name=enabled::${enabled}"
generate_build_matrix:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:

View File

@ -27,7 +27,24 @@ on:
- cron: "50 23 * * *"
jobs:
enable_nightly_build:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.set-enabled.outputs.enabled }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set enabled
id: set-enabled
run: |
enabled=$(python scripts/github_actions/run-nightly-build.py)
echo "enabled: $enabled"
echo "::set-output name=enabled::${enabled}"
generate_build_matrix:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:

View File

@ -27,7 +27,24 @@ on:
- cron: "50 23 * * *"
jobs:
enable_nightly_build:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.set-enabled.outputs.enabled }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set enabled
id: set-enabled
run: |
enabled=$(python scripts/github_actions/run-nightly-build.py)
echo "enabled: $enabled"
echo "::set-output name=enabled::${enabled}"
generate_build_matrix:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:

View File

@ -27,7 +27,24 @@ on:
- cron: "50 23 * * *"
jobs:
enable_nightly_build:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.set-enabled.outputs.enabled }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set enabled
id: set-enabled
run: |
enabled=$(python scripts/github_actions/run-nightly-build.py)
echo "enabled: $enabled"
echo "::set-output name=enabled::${enabled}"
generate_build_matrix:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:

View File

@ -27,7 +27,24 @@ on:
- cron: "50 23 * * *"
jobs:
enable_nightly_build:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.set-enabled.outputs.enabled }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set enabled
id: set-enabled
run: |
enabled=$(python scripts/github_actions/run-nightly-build.py)
echo "enabled: $enabled"
echo "::set-output name=enabled::${enabled}"
generate_build_matrix:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:

View File

@ -27,7 +27,24 @@ on:
- cron: "50 23 * * *"
jobs:
enable_nightly_build:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.set-enabled.outputs.enabled }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set enabled
id: set-enabled
run: |
enabled=$(python scripts/github_actions/run-nightly-build.py)
echo "enabled: $enabled"
echo "::set-output name=enabled::${enabled}"
generate_build_matrix:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:

View File

@ -27,7 +27,24 @@ on:
- cron: "50 23 * * *"
jobs:
enable_nightly_build:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.set-enabled.outputs.enabled }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set enabled
id: set-enabled
run: |
enabled=$(python scripts/github_actions/run-nightly-build.py)
echo "enabled: $enabled"
echo "::set-output name=enabled::${enabled}"
generate_build_matrix:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:

View File

@ -39,8 +39,8 @@ jobs:
id: set-matrix
run: |
# outputting for debugging purposes
python scripts/github_actions/generate_build_matrix.py
MATRIX=$(python scripts/github_actions/generate_build_matrix.py)
python scripts/github_actions/generate_build_matrix.py --test-only-latest-torch
MATRIX=$(python scripts/github_actions/generate_build_matrix.py --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}"
run_tests_macos_cpu:

View File

@ -39,8 +39,8 @@ jobs:
id: set-matrix
run: |
# outputting for debugging purposes
python scripts/github_actions/generate_build_matrix.py
MATRIX=$(python scripts/github_actions/generate_build_matrix.py)
python scripts/github_actions/generate_build_matrix.py --test-only-latest-torch
MATRIX=$(python scripts/github_actions/generate_build_matrix.py --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}"
run_tests_ubuntu_cpu:

View File

@ -39,8 +39,8 @@ jobs:
id: set-matrix
run: |
# outputting for debugging purposes
python scripts/github_actions/generate_build_matrix.py
MATRIX=$(python scripts/github_actions/generate_build_matrix.py)
python scripts/github_actions/generate_build_matrix.py --test-only-latest-torch
MATRIX=$(python scripts/github_actions/generate_build_matrix.py --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}"
run_tests_windows_cpu:

View File

@ -0,0 +1,35 @@
#!/usr/bin/env python3
# Copyright 2022 Xiaomi Corp. (authors: Fangjun Kuang)
import subprocess
from datetime import datetime, timedelta
def get_last_commit_date() -> datetime:
date = (
subprocess.check_output(
[
"git",
"log",
"-1",
"--format=%ad",
"--date=unix",
]
)
.decode("ascii")
.strip()
)
return datetime.utcfromtimestamp(int(date))
def main():
last_commit_date_utc = get_last_commit_date()
now_utc = datetime.utcnow()
if last_commit_date_utc + timedelta(days=1) > now_utc:
print("true")
else:
print("false")
if __name__ == "__main__":
main()