[HSE] A03 Artyom Smorodskij #2322
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 | |
on: | |
pull_request: | |
types: [synchronize, opened, reopened, edited] | |
jobs: | |
job1: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: refs/pull/${{ github.event.pull_request.number }}/head | |
- name: Check pull request's name | |
run: | | |
prName="${{ github.event.pull_request.title }}" | |
university=`echo $prName | awk '{ sub(/.*\[/, ""); sub(/\].*/, ""); print }'` | |
universities=("SPBGU" "NUP" "CUB" "ITMO" "HSE") | |
if [[ ! $(echo ${universities[@]} | grep -F -w $university) ]]; | |
then | |
echo "FIASCO: Wrong university name or format in pull request title: $university " | |
exit 1 | |
fi | |
echo "your university $university " | |
echo $university > university.txt | |
- name: Check branches compatibility | |
run: | | |
if [ "${{ github.base_ref }}" != "${{ github.head_ref }}" ]; then | |
echo "FIASCO: base and head branches differs" | |
exit 1 | |
fi | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up Docker cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./.github/workflows/Dockerfile | |
tags: berezun/lama-image:latest | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: Store Docker cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Run tests | |
run: | | |
docker run -d -it --name lama-testing-image berezun/lama-image | |
docker cp . lama-testing-image:/home/opam/lama | |
docker exec -u root -t lama-testing-image chown -R opam:opam /home/opam/lama | |
docker exec -u opam -w /home/opam/lama -t lama-testing-image sh -c 'eval $(opam config env) && make' | |
echo "Regression: All checks have successfully passed" | |
# - name: Check Deadline | |
# run: | | |
# deadline=2025-03-04T23:59 | |
# if [[ $(date +'%Y-%m-%d') > $deadline ]]; | |
# then | |
# echo "FIASCO: The deadline has expired" | |
# exit 1 | |
# fi | |
- name: Prepare results | |
run: | | |
login=${{ github.event.pull_request.user.login }} | |
echo "$login" > gitid.txt | |
echo ${{ github.base_ref }} > base.txt | |
branch=${{ github.base_ref }} | |
if [[ ${branch:1:1} -eq 0 ]] | |
then | |
echo ${branch:2:1} > assignment_number.txt | |
else | |
echo ${branch:1:2} > assignment_number.txt | |
fi | |
- name: Upload results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: share_info | |
path: | | |
gitid.txt | |
base.txt | |
assignment_number.txt | |
university.txt |