forked from omegaup/omegaup
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (52 loc) · 2.38 KB
/
libomegaup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Update libomegaup
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Use PHP 8.1
run: |
sudo update-alternatives --install /usr/bin/php php /usr/bin/php8.1 100
# Enable APCu for tests
echo 'apc.enable_cli=1' | sudo tee --append /etc/php/8.1/cli/conf.d/20-apcu.ini >/dev/null
# Enable coverage for XDebug so that codecov can do its magic.
echo 'xdebug.mode=coverage' | sudo tee --append /etc/php/8.1/cli/conf.d/20-xdebug.ini >/dev/null
- name: Install composer dependencies
run: composer install --prefer-dist --no-progress
- name: Install Python dependencies
run: python3 -m pip install yapf==0.30.0
- name: Prepare Psalm
run: |
# Create optional directories to simplify psalm config.
mkdir -p frontend/www/{phpminiadmin,preguntas}
touch 'frontend/server/config.php'
touch 'frontend/tests/test_config.php'
- name: Update libomegaup
run: |
set -e
SUBJECT="omegaUp API change for \"$(git show "${{ github.sha }}" --format=%s --no-patch)\""
BODY="API changes from https://github.com/omegaup/omegaup/commit/${{ github.sha }}"
MESSAGE="$(printf "%s\n\n%s\n" "${SUBJECT}" "${BODY}")"
git clone --depth=1 "https://omegaup-bot:${{ secrets.OMEGAUPBOT_RELEASE_TOKEN }}@github.com/omegaup/libomegaup" /tmp/libomegaup
php frontend/server/cmd/APITool.php --file api.py | yapf | sed -e 's/^\s\+$//' > /tmp/libomegaup/omegaup/api.py
(cd /tmp/libomegaup &&
git config --local user.name "omegaup-bot" &&
git config --local user.email "[email protected]" &&
python3 -m pip install -r requirements/test.txt -r requirements.txt &&
make docs &&
([[ -z "$(git status --porcelain)" ]] || (
git commit -am "${MESSAGE}" &&
git push origin "HEAD:refs/heads/pr-${{ github.sha }}" &&
GITHUB_TOKEN="${{ secrets.OMEGAUPBOT_RELEASE_TOKEN }}" gh pr create --title "${SUBJECT}" --body "${BODY}" --head "pr-${{ github.sha }}" --base main
))
)
rm -rf /tmp/libomegaup