Skip to content

Commit 6db7ba3

Browse files
committed
Test if PAT works
1 parent 85618bd commit 6db7ba3

File tree

1 file changed

+144
-129
lines changed

1 file changed

+144
-129
lines changed

.github/workflows/run-examples-prep.yml

Lines changed: 144 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -7,147 +7,162 @@ jobs:
77
runs-on: ubuntu-latest
88
permissions:
99
contents: write
10-
strategy:
11-
fail-fast: false
12-
max-parallel: 1
13-
matrix:
14-
python-version: ['3.11', '3.12', '3.13']
10+
# strategy:
11+
# fail-fast: false
12+
# max-parallel: 1
13+
# matrix:
14+
# python-version: ['3.11', '3.12', '3.13']
1515

1616
steps:
17-
# Detect modified PDL files, includes Add, Modified, but not Deleted
18-
- uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
- name: Detect all PDL files that were changed or added
22-
id: changed-pdl-files
23-
uses: tj-actions/changed-files@6cb76d07bee4c9772c6882c06c37837bf82a04d3 # v46
24-
with:
25-
files: |
26-
**.pdl
27-
json: "true"
28-
escape_json: "false"
29-
- name: List PDL files that were modified or added and append to test_examples_run
17+
18+
- name: Push the new run-examples yaml config
19+
shell: bash
3020
run: |
31-
echo ${{ steps.changed-pdl-files.outputs.all_changed_files }}
32-
if [ ${{ steps.changed-pdl-files.outputs.all_changed_files_count }} -gt 0 ]; then
33-
echo "early-stop=false" >> $GITHUB_ENV
34-
else
35-
echo "No file need to be checked, skipping all subsequent tests."
36-
echo "early-stop=true" >> $GITHUB_ENV
37-
fi
21+
echo "This is a test: $(date)" > test-file.txt
22+
git config --local user.name github-actions[bot]
23+
git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com
24+
git remote set-url fork-remote https://${{ secrets.PDL_PAT }}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git
25+
git status
26+
git pull fork-remote ${{ github.head_ref }}
27+
git add test-file.txt
28+
git diff --cached --quiet || git commit -s -m "github-actions[bot]: Simple test for PAT"
29+
git push fork-remote ${{ github.head_ref }}
30+
31+
# # Detect modified PDL files, includes Add, Modified, but not Deleted
32+
# - uses: actions/checkout@v4
33+
# with:
34+
# fetch-depth: 0
35+
# - name: Detect all PDL files that were changed or added
36+
# id: changed-pdl-files
37+
# uses: tj-actions/changed-files@6cb76d07bee4c9772c6882c06c37837bf82a04d3 # v46
38+
# with:
39+
# files: |
40+
# **.pdl
41+
# json: "true"
42+
# escape_json: "false"
43+
# - name: List PDL files that were modified or added and append to test_examples_run
44+
# run: |
45+
# echo ${{ steps.changed-pdl-files.outputs.all_changed_files }}
46+
# if [ ${{ steps.changed-pdl-files.outputs.all_changed_files_count }} -gt 0 ]; then
47+
# echo "early-stop=false" >> $GITHUB_ENV
48+
# else
49+
# echo "No file need to be checked, skipping all subsequent tests."
50+
# echo "early-stop=true" >> $GITHUB_ENV
51+
# fi
3852

39-
# Run tests if there are modified PDL files
40-
- name: Check if update results automatically by GitHub Actions Bot
41-
if: ${{ env.early-stop == 'false' }}
42-
id: parse-run-examples-config
43-
shell: bash
44-
run: |
45-
value=$(yq '.update_results' tests/test_examples_run.yaml | tr '[:upper:]' '[:lower:]')
46-
echo "value=$value"
47-
echo "update_results=$value" >> $GITHUB_ENV
53+
# # Run tests if there are modified PDL files
54+
# - name: Check if update results automatically by GitHub Actions Bot
55+
# if: ${{ env.early-stop == 'false' }}
56+
# id: parse-run-examples-config
57+
# shell: bash
58+
# run: |
59+
# value=$(yq '.update_results' tests/test_examples_run.yaml | tr '[:upper:]' '[:lower:]')
60+
# echo "value=$value"
61+
# echo "update_results=$value" >> $GITHUB_ENV
4862

49-
# Set up Ollama
50-
# - name: Cache Ollama model files
63+
# # Set up Ollama
64+
# # - name: Cache Ollama model files
65+
# # if: ${{ env.early-stop == 'false' }}
66+
# # uses: actions/cache@v4
67+
# # with:
68+
# # path: /usr/share/ollama/.ollama/models
69+
# # key: ${{ runner.os }}-build-ollama-cache
70+
# # restore-keys: |
71+
# # ${{ runner.os }}-build-
72+
# # ${{ runner.os }}
73+
# - uses: ./.github/actions/ollama
74+
# if: ${{ env.early-stop == 'false' }}
75+
76+
# # Set up Run Examples environment
77+
# - name: Set up Python ${{ matrix.python-version }}
78+
# uses: actions/setup-python@v5
5179
# if: ${{ env.early-stop == 'false' }}
80+
# with:
81+
# python-version: ${{ matrix.python-version }}
82+
# - name: Cache pip
5283
# uses: actions/cache@v4
84+
# if: ${{ env.early-stop == 'false' }}
5385
# with:
54-
# path: /usr/share/ollama/.ollama/models
55-
# key: ${{ runner.os }}-build-ollama-cache
86+
# # This path is specific to Ubuntu
87+
# path: ${{ env.pythonLocation }}
88+
# # Look to see if there is a cache hit for the setup file
89+
# key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
5690
# restore-keys: |
57-
# ${{ runner.os }}-build-
58-
# ${{ runner.os }}
59-
- uses: ./.github/actions/ollama
60-
if: ${{ env.early-stop == 'false' }}
61-
62-
# Set up Run Examples environment
63-
- name: Set up Python ${{ matrix.python-version }}
64-
uses: actions/setup-python@v5
65-
if: ${{ env.early-stop == 'false' }}
66-
with:
67-
python-version: ${{ matrix.python-version }}
68-
- name: Cache pip
69-
uses: actions/cache@v4
70-
if: ${{ env.early-stop == 'false' }}
71-
with:
72-
# This path is specific to Ubuntu
73-
path: ${{ env.pythonLocation }}
74-
# Look to see if there is a cache hit for the setup file
75-
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
76-
restore-keys: |
77-
${{ runner.os }}-pip-new3
78-
${{ runner.os }}-new3
79-
- name: Install dependencies
80-
if: ${{ env.early-stop == 'false' }}
81-
shell: bash
82-
run: pip install --upgrade --upgrade-strategy eager .[all]
83-
- name: Pip list packages
84-
if: ${{ env.early-stop == 'false' }}
85-
shell: bash
86-
run: pip list
87-
- name: Patch tests/test_examples_run.yaml check with modified files
88-
if: ${{ env.early-stop == 'false' }}
89-
shell: bash
90-
run: |
91-
yq -i '.check = (${{ steps.changed-pdl-files.outputs.all_changed_files }})' tests/test_examples_run.yaml
92-
- name: View Run Examples config
93-
if: ${{ env.early-stop == 'false' }}
94-
shell: bash
95-
run: cat tests/test_examples_run.yaml
96-
- name: Run Pytest
97-
if: ${{ env.early-stop == 'false' }}
98-
shell: bash
99-
run: |
100-
(
101-
set +e
102-
py.test -v --capture=tee-sys -rfE -s tests/test_examples_run.py --disable-pytest-warnings
103-
EXIT_CODE=$?
91+
# ${{ runner.os }}-pip-new3
92+
# ${{ runner.os }}-new3
93+
# - name: Install dependencies
94+
# if: ${{ env.early-stop == 'false' }}
95+
# shell: bash
96+
# run: pip install --upgrade --upgrade-strategy eager .[all]
97+
# - name: Pip list packages
98+
# if: ${{ env.early-stop == 'false' }}
99+
# shell: bash
100+
# run: pip list
101+
# - name: Patch tests/test_examples_run.yaml check with modified files
102+
# if: ${{ env.early-stop == 'false' }}
103+
# shell: bash
104+
# run: |
105+
# yq -i '.check = (${{ steps.changed-pdl-files.outputs.all_changed_files }})' tests/test_examples_run.yaml
106+
# - name: View Run Examples config
107+
# if: ${{ env.early-stop == 'false' }}
108+
# shell: bash
109+
# run: cat tests/test_examples_run.yaml
110+
# - name: Run Pytest
111+
# if: ${{ env.early-stop == 'false' }}
112+
# shell: bash
113+
# run: |
114+
# (
115+
# set +e
116+
# py.test -v --capture=tee-sys -rfE -s tests/test_examples_run.py --disable-pytest-warnings
117+
# EXIT_CODE=$?
104118

105-
if [ $EXIT_CODE -eq 0 ]; then
106-
echo "TEST_RESULT=PASSED" >> $GITHUB_ENV
107-
else
108-
echo "TEST_RESULT=FAILED" >> $GITHUB_ENV
109-
fi
110-
)
119+
# if [ $EXIT_CODE -eq 0 ]; then
120+
# echo "TEST_RESULT=PASSED" >> $GITHUB_ENV
121+
# else
122+
# echo "TEST_RESULT=FAILED" >> $GITHUB_ENV
123+
# fi
124+
# )
111125

112-
# Commit the results if update results
113-
- name: Push new results to branch
114-
shell: bash
115-
if: ${{ env.early-stop == 'false' && env.update_results == 'true' }}
116-
run: |
117-
git config --local user.name github-actions[bot]
118-
git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com
119-
git status
120-
git pull
121-
git add tests/results/
122-
git diff --cached --quiet || git commit -s -m "github-actions[bot]: Run examples: updated result files on your behalf"
123-
git push
126+
# # Commit the results if update results
127+
# - name: Push new results to branch
128+
# shell: bash
129+
# if: ${{ env.early-stop == 'false' && env.update_results == 'true' }}
130+
# run: |
131+
# git config --local user.name github-actions[bot]
132+
# git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com
133+
# git status
134+
# git pull
135+
# git add tests/results/
136+
# git diff --cached --quiet || git commit -s -m "github-actions[bot]: Run examples: updated result files on your behalf"
137+
# git push
124138

125-
# Patch config with update_results to false and commit to PR
126-
- name: Patch tests/test_examples_run.yaml with update_results to False, only for the last job in the series
127-
if: ${{ env.early-stop == 'false' && env.update_results == 'true' && matrix.python-version == '3.13' }}
128-
shell: bash
129-
run: |
130-
yq -i '.update_results = ('false')' tests/test_examples_run.yaml
131-
- name: Push the new run-examples yaml config
132-
if: ${{ env.early-stop == 'false' && env.update_results == 'true' && matrix.python-version == '3.13' }}
133-
shell: bash
134-
run: |
135-
git config --local user.name github-actions[bot]
136-
git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com
137-
git status
138-
git pull
139-
git add tests/test_examples_run.yaml
140-
git diff --cached --quiet || git commit -s -m "github-actions[bot]: Run examples: reverting update_result to false on your behalf"
141-
git push
139+
# # Patch config with update_results to false and commit to PR
140+
# - name: Patch tests/test_examples_run.yaml with update_results to False, only for the last job in the series
141+
# if: ${{ env.early-stop == 'false' && env.update_results == 'true' && matrix.python-version == '3.13' }}
142+
# shell: bash
143+
# run: |
144+
# yq -i '.update_results = ('false')' tests/test_examples_run.yaml
145+
# - name: Push the new run-examples yaml config
146+
# if: ${{ env.early-stop == 'false' && env.update_results == 'true' && matrix.python-version == '3.13' }}
147+
# shell: bash
148+
# run: |
149+
# git config --local user.name github-actions[bot]
150+
# git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com
151+
# git remote set-url origin https://${{ secrets.PDL_PAT }}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git
152+
# git status
153+
# git pull origin ${{ github.head_ref }}
154+
# git add tests/test_examples_run.yaml
155+
# git diff --cached --quiet || git commit -s -m "github-actions[bot]: Run examples: reverting update_result to false on your behalf"
156+
# git push origin ${{ github.head_ref }}
142157

143-
- name: Check if pytest passed
144-
shell: bash
145-
if: ${{ env.early-stop == 'false' }}
146-
run: |
147-
if [ "$TEST_RESULT" == "PASSED" ]; then
148-
exit 0
149-
else
150-
exit 1
151-
fi
158+
# - name: Check if pytest passed
159+
# shell: bash
160+
# if: ${{ env.early-stop == 'false' }}
161+
# run: |
162+
# if [ "$TEST_RESULT" == "PASSED" ]; then
163+
# exit 0
164+
# else
165+
# exit 1
166+
# fi
152167

153168

0 commit comments

Comments
 (0)