Regression | Generate #29
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
name: Regression | Generate | |
on: | |
workflow_dispatch: | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
jobs: | |
remove-existing-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Delete branch | |
run: git push origin --delete bot/regression || true | |
generate-ubuntu: | |
needs: remove-existing-branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y cmake g++-12 | |
curl -sSf https://apt.llvm.org/llvm.sh | sudo bash -s -- 17 all | |
- name: Install CWhy | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install . | |
- name: Generate current prompts | |
run: python3 -m tests.regression --platform ubuntu --generate | |
- name: Commit | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git switch -c bot/regression/ubuntu | |
if [[ `git status --porcelain` ]]; then | |
git add tests/.regression | |
git commit -m "[bot][ubuntu] Generate current state of CWhy prompts" | |
fi | |
git push origin --delete bot/regression/ubuntu || true | |
git push origin bot/regression/ubuntu | |
generate-macos: | |
needs: remove-existing-branch | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install CWhy | |
run: | | |
python3 -m pip install --break-system-packages --upgrade pip | |
pip install --break-system-packages --upgrade setuptools # https://stackoverflow.com/questions/7446187 | |
python3 -m pip install --break-system-packages . | |
- name: Generate current prompts | |
run: python3 -m tests.regression --platform macos --generate | |
- name: Commit | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git switch -c bot/regression/macos | |
if [[ `git status --porcelain` ]]; then | |
git add tests/.regression | |
git commit -m "[bot][macos] Generate current state of CWhy prompts" | |
fi | |
git push origin --delete bot/regression/macos || true | |
git push origin bot/regression/macos | |
generate-windows: | |
needs: remove-existing-branch | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install CWhy | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install . | |
- name: Generate current prompts | |
run: python3 -m tests.regression --platform windows --generate | |
- name: Commit | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git switch -c bot/regression/windows | |
$status = git status --porcelain | |
if (!$status) { | |
git add tests/.regression | |
git commit -m "[bot][windows] Generate current state of CWhy prompts" | |
} | |
git push origin --delete bot/regression/windows || true | |
git push origin bot/regression/windows | |
create-pull-request: | |
needs: [generate-ubuntu, generate-macos, generate-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Merge branches | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git switch -c bot/regression | |
git pull --rebase origin bot/regression/ubuntu | |
git pull --rebase origin bot/regression/macos | |
git pull --rebase origin bot/regression/windows | |
git push origin --delete bot/regression || true | |
git push origin --delete bot/regression/ubuntu | |
git push origin --delete bot/regression/macos | |
git push origin --delete bot/regression/windows | |
git push origin bot/regression | |
- name: Create pull request | |
run: | | |
curl --fail-with-body -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/plasma-umass/cwhy/pulls \ | |
-d '{"title":"[bot] Generate current state of CWhy prompts","body":"Timestamp: ${{github.event.repository.updated_at}}","head":"bot/regression","base":"main"}' |