-
Notifications
You must be signed in to change notification settings - Fork 3
125 lines (110 loc) · 3.76 KB
/
pullrequest.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: PullRequestAction
on:
pull_request_target:
branches: [ main, master ]
paths-ignore:
- .github/workflows/push.yml
jobs:
build:
runs-on: [ self-hosted, containers-runner ]
steps:
- name: Cancel previous runs
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch git repository
uses: actions/checkout@v2
with:
fetch-depth: 0
path: container-repo
- name: Merge test branch
uses: linaro-its/[email protected]
with:
path: container-repo
- name: Determine image tag
run: |
IMAGE_TAG=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c 1-7)
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
- run: env
- run: cat $GITHUB_EVENT_PATH
- name: Build container image
run: |
cd $GITHUB_WORKSPACE/container-repo
# Do some magic to figure out what our base image is
IFS=' ' read -ra FOO <<< $(grep "FROM" Dockerfile)
# Make sure we have the latest Ubuntu base image
docker pull ${FOO[1]}
# and then build our container.
docker build --force-rm -t "linaroits/jekyllsitebuild:$IMAGE_TAG" .
test:
runs-on: [ self-hosted, containers-runner ]
needs: build
strategy:
matrix:
site: [96boards-ai, 96boards-docs, 96boards-org, connect,
devicetree, linaro-cloud, linaro-org, lkft,
morello, mlplatform, op-tee, openamp,
trustedfirmware]
include:
- site: 96boards-ai
repo: 96Boards/ai
- site: 96boards-docs
repo: 96Boards/documentation
- site: 96boards-org
repo: 96Boards/website
- site: connect
repo: Linaro/Connect
- site: devicetree
repo: devicetree-org/devicetree-website
- site: linaro-cloud
repo: Linaro/cloud
- site: linaro-org
repo: Linaro/website
- site: lkft
repo: Linaro/lkft-website
- site: morello
repo: MorelloProject/website
- site: mlplatform
repo: ArmNNWebsite/website
- site: op-tee
repo: OP-TEE/optee_website
- site: openamp
repo: OpenAMP/website
- site: trustedfirmware
repo: TrustedFirmwareWebsite/website
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ matrix.site }}
repository: ${{ matrix.repo }}
- name: Initialise environment
run: cat "$GITHUB_WORKSPACE/${{ matrix.site }}/.github-env-master" >> $GITHUB_ENV
- name: Determine image tag
run: |
IMAGE_TAG=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c 1-7)
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
- name: Directory push/pop
uses: linaro-its/[email protected]
with:
cacheDirectory: /srv/site-builds
namedDirectory: ${{ env.SITE_URL }}
destinationDirectory: ${{ github.workspace }}/${{ matrix.site }}
popAtEnd: false
- name: Build site
run: |
cd $GITHUB_WORKSPACE/${{ matrix.site }}
JEKYLLSITEBUILD=$IMAGE_TAG ./build-site.sh
finally:
runs-on: [ self-hosted, containers-runner ]
needs:
- build
- test
if: "always()&&(needs.build.result=='success')"
steps:
- name: Determine image tag
run: |
IMAGE_TAG=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c 1-7)
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
- name: Remove test Docker image
run: docker rmi linaroits/jekyllsitebuild:$IMAGE_TAG