Skip to content

fix test FList

fix test FList #116

Workflow file for this run

name: test + strip + deploy student
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container: pschaus/minicp:version1.1
steps:
- uses: actions/checkout@v2
- name: Step1 - Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Step2 - Install python dependencies
run: |
# python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Step3 - Test
run: |
mvn test
- name: Step 4 - Strip exercises for students
env:
MY_SSH_KEY: ${{ secrets.MY_SSH_KEY }}
#KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
run: |
echo "generate commit in algorithm_exercises and hide solutions..."
echo "config git ..."
git config --global user.name github-actions
git config --global user.email pschaus@users.noreply.github.com
echo "setup ssh keys ..."
mkdir -p ~/.ssh
(umask 077 ; echo $MY_SSH_KEY | base64 --decode > ~/.ssh/id_rsa)
chmod -R 700 ~/.ssh
md5sum ~/.ssh/id_rsa
#ssh -i ~/.ssh/id_rsa -vvvv -o StrictHostKeyChecking=no git@github.com
echo "clone ..."
ls ~/.ssh/id_rsa
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -vvvv -o StrictHostKeyChecking=no" git clone git@github.com:pschaus/algorithms_exercises_students.git
echo "rm src ..."
cd algorithms_exercises_students
ls
if [ -d "src" ]; then git rm -rf ./src; fi
cd ..
echo "regenerate sources"
echo "strip algorithms_exercises_students ..."
amanda --orig src/ --dest algorithms_exercises_students/src/
echo "copy other files ..."
cp README.md algorithms_exercises_students/.
cp pom.xml algorithms_exercises_students/.
cp -r libs algorithms_exercises_students/.
cp -r data algorithms_exercises_students/.
cd algorithms_exercises_students
- name: Compiling source code for students
run: |
cd algorithms_exercises_students
mvn compile
- name: Compiling test for the students
run: |
cd algorithms_exercises_students
mvn test-compile
- name: Publishing the student repo if there were changes
env:
MY_SSH_KEY: ${{ secrets.MY_SSH_KEY }}
#KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
run: |
cd algorithms_exercises_students
# git diff --exit-code is the normal git diff command but return 0 if there are no changes, or 1 if there are
# This avoid crashing when we do a commit on something that is not pushed on the student repo
if ! (git diff --exit-code >> /dev/null)
then
git add -A
git commit -m "generated at $(date)"
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -vvvv -o StrictHostKeyChecking=no" git push
fi
cd ..