-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add platform_tests for installation on multiple platforms including m…
…acos, ubuntu and windows (#119)
- Loading branch information
Showing
5 changed files
with
169 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,12 @@ | ||
function setup_build_env { | ||
python -m pip install --upgrade pip | ||
python -m pip install tox | ||
python -m pip install flake8 | ||
python -m pip install bandit | ||
python -m pip install packaging | ||
python -m pip install ruff | ||
} | ||
|
||
function install_all { | ||
python -m pip install -e .[dev] | ||
} |
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,8 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
source $(dirname "$0")/env_setup.sh | ||
|
||
setup_build_env | ||
install_all |
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,77 @@ | ||
name: Platform Tests | ||
on: | ||
schedule: | ||
- cron: '59 07 * * *' # UTC 7:59(23:59 PST Winter Time) everyday | ||
workflow_dispatch: | ||
inputs: | ||
repository: | ||
description: 'The repository from which the slash command was dispatched' | ||
required: true | ||
comment-id: | ||
description: 'The comment-id of the slash command' | ||
required: true | ||
pr-sha: | ||
description: 'The pr-sha of which the slash command was dispatched' | ||
required: true | ||
branch_or_pr_number: | ||
description: 'dummy parameter to allow benchmark workflow to run' | ||
required: false | ||
fork_info: | ||
description: 'Get info of forked repository and branch' | ||
required: false | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create URL to the run output | ||
if: (github.event_name == 'workflow_dispatch') | ||
id: vars | ||
run: echo ::set-output name=run-url::https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | ||
|
||
- name: Create comment | ||
if: (github.event_name == 'workflow_dispatch') | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
token: ${{ secrets.CICD_PAT }} | ||
repository: ${{ github.event.inputs.repository }} | ||
comment-id: ${{ github.event.inputs.comment-id }} | ||
body: | | ||
[Platform Tests Output][1] | ||
[1]: ${{ steps.vars.outputs.run-url }} | ||
install: | ||
needs: setup | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, windows-latest, ubuntu-latest] | ||
python: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- name: Checkout repository for PR | ||
if: (github.event_name == 'workflow_dispatch') | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.pr-sha }} | ||
- name: Checkout repository for nightly test | ||
if: (github.event_name == 'schedule') | ||
uses: actions/checkout@v4 | ||
- name: Setup Miniconda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
activate-environment: assistant_py3 | ||
environment-file: .github/workflows_env/unittest_env.yml | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python }} | ||
miniconda-version: "latest" | ||
- name: test-install | ||
shell: bash -l {0} | ||
run: | | ||
chmod +x ./.github/workflow_scripts/test_install.sh && ./.github/workflow_scripts/test_install.sh |
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,66 @@ | ||
name: Slash Command Dispatch | ||
on: | ||
issue_comment: | ||
types: [created] | ||
jobs: | ||
slashCommandDispatch: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.issue.pull_request }} | ||
steps: | ||
- name: Get PR SHA | ||
id: sha | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
script: | | ||
const { owner, repo, number } = context.issue; | ||
const pr = await github.pulls.get({ | ||
owner, | ||
repo, | ||
pull_number: number, | ||
}); | ||
return pr.data.head.sha | ||
- name: Get PR number | ||
id: pr_number | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
script: | | ||
const { owner, repo, number } = context.issue; | ||
return number | ||
- name: Get Forked Repository and Branch | ||
id: pr_info | ||
run: | | ||
# Use the GitHub API to fetch information about the pull request | ||
pr_info=$(curl -s -H "Authorization: token ${{ secrets.CICD_PAT }}" \ | ||
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.pr_number.outputs.result }}") | ||
# Extract the forked repository and branch from the pull request info | ||
forked_repo=$(echo "$pr_info" | jq -r '.head.repo.full_name') | ||
forked_branch=$(echo "$pr_info" | jq -r '.head.ref') | ||
echo "Forked Repository: $forked_repo" | ||
echo "Forked Branch: $forked_branch" | ||
echo "FORK_NAME=$forked_repo" >> $GITHUB_OUTPUT | ||
echo "FORK_BRANCH=$forked_branch" >> $GITHUB_OUTPUT | ||
- name: Slash Command Dispatch | ||
id: scd | ||
uses: peter-evans/slash-command-dispatch@v4 | ||
with: | ||
token: ${{ secrets.CICD_PAT }} | ||
permission: write | ||
commands: | | ||
platform_tests | ||
dispatch-type: workflow | ||
static-args: | | ||
repository=${{ github.repository }} | ||
comment-id=${{ github.event.comment.id }} | ||
pr-sha=${{ steps.sha.outputs.result }} | ||
branch_or_pr_number=PR-${{ steps.pr_number.outputs.result }} | ||
fork_info=${{ steps.pr_info.outputs.FORK_NAME }}|${{ steps.pr_info.outputs.FORK_BRANCH }} | ||
- name: Edit comment with error message | ||
if: steps.scd.outputs.error-message | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
comment-id: ${{ github.event.comment.id }} | ||
body: | | ||
> ${{ steps.scd.outputs.error-message }} |
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,6 @@ | ||
name: assistant_py3 | ||
dependencies: | ||
- pip | ||
- pip: | ||
- nose | ||
- flake8 |