Dummy PR : GitHub Action to ensure tokens consistency #8
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: Verify Constants | |
on: | |
push: | |
paths: | |
- "chebai/preprocessing/reader.py" | |
pull_request: | |
paths: | |
- "chebai/preprocessing/reader.py" | |
jobs: | |
verify-constants: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "pypy3.9", "pypy3.10", "3.9", "3.10", "3.11" ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set PYTHONPATH | |
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV | |
- name: Get list of changed files | |
id: changed_files | |
run: | | |
git fetch origin dev | |
# Get the list of changed files compared to origin/dev and save them to a file | |
git diff --name-only origin/dev > changed_files.txt | |
# Print the names of changed files on separate lines | |
echo "Changed files:" | |
while read -r line; do | |
echo "Changed File name : $line" | |
done < changed_files.txt | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu | |
python -m pip install -e . | |
- name: Export constants | |
run: python .github/workflows/export_constants.py | |
- name: Load constants into environment variables | |
id: load_constants | |
run: | | |
constants=$(cat constants.json) | |
echo "$constants" | jq -r 'to_entries|map("export \(.key)=\(.value|tostring)")|.[]' >> $GITHUB_ENV | |
- name: Verify constants | |
run: | | |
if grep -q "chebai/preprocessing/reader.py" changed_files.txt; then | |
if [ "$EMBEDDING_OFFSET" != "10" ]; then | |
echo "EMBEDDING_OFFSET does not match expected value!" | |
exit 1 | |
fi | |
if [ "$CLS_TOKEN" != "2" ]; then | |
echo "CLS_TOKEN does not match expected value!" | |
exit 1 | |
fi | |
if [ "$PADDING_TOKEN_INDEX" != "0" ]; then | |
echo "PADDING_TOKEN_INDEX does not match expected value!" | |
exit 1 | |
fi | |
if [ "$MASK_TOKEN_INDEX" != "1" ]; then | |
echo "MASK_TOKEN_INDEX does not match expected value!" | |
exit 1 | |
fi | |
fi |