-
Notifications
You must be signed in to change notification settings - Fork 8
61 lines (52 loc) · 2.4 KB
/
build-test.yml
File metadata and controls
61 lines (52 loc) · 2.4 KB
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
name: Bench Build Test
on:
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.repository }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
Bench-Build-Test:
runs-on: ubuntu-latest
container:
image: docker.io/frappe/bench:latest
options: --user root
steps:
- name: Setup Github ENV
run: |
echo "HOME=/home/frappe" >> $GITHUB_ENV
echo "PATH=/home/frappe/.local/bin:$PATH" >> $GITHUB_ENV
- name: Create a new minimal bench
run: |
cd /home/frappe
su frappe bash -c "bench init frappe-bench --skip-redis-config-generation --no-procfile --skip-assets"
- name: Get Dependent Apps
run: |
cd /home/frappe/frappe-bench
# Use public URL for public repos, authenticated URL for private repos
if [ "${{ github.event.pull_request.head.repo.private }}" = "false" ]; then
# This is a public repository (could be a fork or not)
git clone https://github.com/${{ github.event.pull_request.head.repo.full_name }} -b ${{ github.event.pull_request.head.ref }} --depth=1 app_repo
else
# Private repository, use authentication
git clone https://rtbot:${{ secrets.RTBOT_TOKEN }}@github.com/${{ github.event.pull_request.head.repo.full_name }} -b ${{ github.event.pull_request.head.ref }} --depth=1 app_repo
fi
DEPS=$(grep -E "required_apps\s*=\s*\[" app_repo/*/hooks.py | sed 's/.*\[\(.*\)\]/\1/g' | tr -d '"' | tr -d "'" | tr ',' '\n' | awk '{$1=$1};1')
rm -rf app_repo
for dep in $DEPS; do
su frappe bash -c "bench get-app $dep"
done
- name: Get APP and Build
run: |
cd /home/frappe/frappe-bench
if [ "${{ github.event.pull_request.head.repo.private }}" = "false" ]; then
# Public fork
su frappe bash -c "bench get-app https://github.com/${{ github.event.pull_request.head.repo.full_name }} --branch ${{ github.event.pull_request.head.ref }}"
else
# Private fork (requires token)
su frappe bash -c "bench get-app https://rtbot:${{ secrets.RTBOT_TOKEN }}@github.com/${{ github.event.pull_request.head.repo.full_name }} --branch ${{ github.event.pull_request.head.ref }}"
fi
- name: Cleanup
if: ${{ always() }}
uses: rtCamp/action-cleanup@master