Files

67 lines
2.1 KiB
YAML

# Samples are private; only core devs can access them.
name: Regression Test
on:
push:
branches: [main, update-tests]
jobs:
regtest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
path: project
- name: Commit Message
id: commit_message
working-directory: ./project
run: |
COMMIT_MSG=$(git log -1 --pretty=%B | head -n 1)
echo "message=$(date +'%Y%m%d')-$(git rev-parse --short HEAD)-${COMMIT_MSG}" >> $GITHUB_OUTPUT
- name: Build
working-directory: ./project
run: |
mkdir build
cd build
cmake ../pycdc
cmake --build . --config Debug
cmake --install .
- name: Checkout regtest repository
uses: actions/checkout@v5
with:
repository: Lil-Ran/armorshot-regtest
token: ${{ secrets.REGTEST_PAT }}
path: regtest
fetch-depth: 1
lfs: true
submodules: true
- name: Run shot.py and check for changes
working-directory: ./regtest
run: |
find . -type f -name '*\.1shot\.*' -exec rm -f {} + >/dev/null 2>&1
touch ./.git/.no1shot
pip install pycryptodome
python3 ../project/oneshot/shot.py . --no-banner >/dev/null 2>&1
if [ -n "$(git status --porcelain)" ]; then
cd ../project
COMMIT_MSG=$(git log -1 --pretty=%B | head -n 1)
echo "$COMMIT_MSG" | grep -q "update tests" || { echo "Workspace changed but commit message does not contain 'update tests'. Failing workflow."; exit 1; }
fi
- name: Commit and push changes
if: ${{
steps.commit_message.outputs.message &&
(hashFiles('regtest/**') != '') &&
(contains(steps.commit_message.outputs.message, 'update tests'))
}}
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
with:
cwd: ./regtest
add: .
default_author: github_actions
message: ${{ steps.commit_message.outputs.message }}