From 0d3e7fa1ac67099e970f1121fe9ffa1e55d12b9c Mon Sep 17 00:00:00 2001 From: Vijay Viswanathan Date: Thu, 16 Nov 2023 18:05:19 -0500 Subject: [PATCH 1/2] Create reusable workflow called base_ci.yml --- .github/workflows/base_ci.yml | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/base_ci.yml diff --git a/.github/workflows/base_ci.yml b/.github/workflows/base_ci.yml new file mode 100644 index 000000000..9c28b6b2c --- /dev/null +++ b/.github/workflows/base_ci.yml @@ -0,0 +1,88 @@ +name: Reusable Continuous Integration Workflow +on: + workflow_call: + +jobs: + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.9', '3.10', '3.11' ] + steps: + - uses: actions/checkout@v3 + - name: Install Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: 'pyproject.toml' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install . + - name: test + run: pytest + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Python 3 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + - name: format + uses: pre-commit/action@v3.0.0 + with: + extra_args: black --all-files + isort: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Python 3 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + - name: isort + uses: pre-commit/action@v3.0.0 + with: + extra_args: isort --all-files + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Python 3 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + - name: lint + uses: pre-commit/action@v3.0.0 + with: + extra_args: flake8 --all-files + - name: lint-pep585-compliant + uses: pre-commit/action@v3.0.0 + with: + extra_args: upgrade-type-hints --all-files + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Python 3 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + - name: mypy + uses: pre-commit/action@v3.0.0 + with: + extra_args: mypy --all-files + markdownlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 18.x + - name: lint + uses: pre-commit/action@v3.0.0 + with: + extra_args: markdownlint-cli2 --all-files From f711cef2e6e9174813710af65fa01e18b2d6327a Mon Sep 17 00:00:00 2001 From: viswavi Date: Thu, 16 Nov 2023 18:28:54 -0500 Subject: [PATCH 2/2] Create two workflows, one for PRs and one for daily CI --- .github/workflows/ci.yml | 92 --------------------------- .github/workflows/daily_ci.yml | 8 +++ .github/workflows/pull_request_ci.yml | 11 ++++ 3 files changed, 19 insertions(+), 92 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/daily_ci.yml create mode 100644 .github/workflows/pull_request_ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 939ee3d1b..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Continuous Integration -on: - push: - branches: - - main - pull_request: - branches: ["**"] - -jobs: - unit-tests: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [ '3.9', '3.10', '3.11' ] - steps: - - uses: actions/checkout@v3 - - name: Install Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: 'pyproject.toml' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - - name: test - run: pytest - format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Python 3 - uses: actions/setup-python@v3 - with: - python-version: 3.9 - - name: format - uses: pre-commit/action@v3.0.0 - with: - extra_args: black --all-files - isort: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Python 3 - uses: actions/setup-python@v3 - with: - python-version: 3.9 - - name: isort - uses: pre-commit/action@v3.0.0 - with: - extra_args: isort --all-files - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Python 3 - uses: actions/setup-python@v3 - with: - python-version: 3.9 - - name: lint - uses: pre-commit/action@v3.0.0 - with: - extra_args: flake8 --all-files - - name: lint-pep585-compliant - uses: pre-commit/action@v3.0.0 - with: - extra_args: upgrade-type-hints --all-files - typecheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Python 3 - uses: actions/setup-python@v3 - with: - python-version: 3.9 - - name: mypy - uses: pre-commit/action@v3.0.0 - with: - extra_args: mypy --all-files - markdownlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Node - uses: actions/setup-node@v3 - with: - node-version: 18.x - - name: lint - uses: pre-commit/action@v3.0.0 - with: - extra_args: markdownlint-cli2 --all-files diff --git a/.github/workflows/daily_ci.yml b/.github/workflows/daily_ci.yml new file mode 100644 index 000000000..58e144bc0 --- /dev/null +++ b/.github/workflows/daily_ci.yml @@ -0,0 +1,8 @@ +name: Daily CI +on: + schedule: + - cron: "0 14 * * *" + +jobs: + call-ci: + uses: neulab/prompt2model/.github/workflows/base_ci.yml@main \ No newline at end of file diff --git a/.github/workflows/pull_request_ci.yml b/.github/workflows/pull_request_ci.yml new file mode 100644 index 000000000..17dc32138 --- /dev/null +++ b/.github/workflows/pull_request_ci.yml @@ -0,0 +1,11 @@ +name: Pull Request CI +on: + push: + branches: + - main + pull_request: + branches: ["**"] + +jobs: + call-ci: + uses: neulab/prompt2model/.github/workflows/base_ci.yml@main \ No newline at end of file