-
Notifications
You must be signed in to change notification settings - Fork 22
146 lines (126 loc) · 5.2 KB
/
build-pr.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Build DocBook xslTNG PR
on:
pull_request_target:
types: [assigned, opened, edited, synchronize, reopened]
branches:
- main
jobs:
check_branch:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.check_step.outputs.branch }}
reponame: ${{ steps.check_step.outputs.reponame }}
tag: ${{ steps.check_step.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get branch name, etc.
id: check_step
run: |
raw=${{ github.repository }}
reponame=${raw##*/}
echo "reponame=$reponame" >> $GITHUB_OUTPUT
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "branch=$branch" >> $GITHUB_OUTPUT
tag=""
if [ ${{ github.ref_type }} = "tag" ]; then
tag=${{ github.ref_name }}
echo "Running in $reponame on $branch for $tag"
else
echo "Running in $reponame on $branch"
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
build-pr:
name: Build xslTNG on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: check_branch
env:
HAVE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN != '' }}
CIWORKFLOW: yes
CI_SHA1: ${{ github.sha }}
CI_BUILD_NUM: ${{ github.run_number }}
CI_PROJECT_USERNAME: ${{ github.repository_owner }}
CI_PROJECT_REPONAME: ${{ needs.check_branch.outputs.reponame }}
CI_BRANCH: ${{ needs.check_branch.outputs.branch }}
CI_TAG: ${{ needs.check_branch.outputs.tag }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Install platform-independent Python modules
run: |
python3 -m pip install pygments==2.14.0 click cython
# Test the build on Mac
- name: Install dependencies on Mac
if: matrix.os == 'macos-11'
run: |
brew install rsync libxml2 libxslt sass/sass/sass
python3 -m pip install saxonche
python3 -m pip install --no-binary lxml html5-parser
- name: Checkout the pull request on Mac
if: matrix.os == 'macos-11'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Get the latest releases (authenticated request on Mac)
if: ${{ matrix.os == 'macos-11' && env.HAVE_ACCESS_TOKEN == 'true' }}
run: |
mkdir -p build
# Don’t attempt to use continuation lines here because Windows
curl --request GET --url https://api.github.com/repos/${{ github.repository }}/releases --header 'authorization: Bearer ${{ secrets.ACCESS_TOKEN }}' -o build/releases.json
- name: Build on Mac
if: matrix.os == 'macos-11'
run: |
./gradlew -PrequireCompileSuccess=true dist
# Test the build on Windows
- name: Install dependencies on Windows
if: matrix.os == 'windows-2019'
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install sass
- name: Checkout the pull request on Windows
if: matrix.os == 'windows-2019'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Get the latest releases (authenticated request on Windows)
if: ${{ matrix.os == 'windows-2019' && env.HAVE_ACCESS_TOKEN == 'true' }}
run: |
mkdir -p build
# Don’t attempt to use continuation lines here because Windows
curl --request GET --url https://api.github.com/repos/${{ github.repository }}/releases --header 'authorization: Bearer ${{ secrets.ACCESS_TOKEN }}' -o build/releases.json
- name: Build on Windows
if: matrix.os == 'windows-2019'
run: |
./gradlew -PrequireCompileSuccess=true -PrequireTestSuccess=false dist
# Test the build on Linux
- name: Install dependencies on Linux
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install epubcheck rsync libxml2-dev libxslt-dev
curl -o /tmp/dart.tar.gz -L https://github.com/sass/dart-sass/releases/download/1.56.0/dart-sass-1.56.0-linux-x64.tar.gz
cd /tmp && tar zxf dart.tar.gz && sudo mv dart-sass/sass /usr/local/bin
python3 -m pip install saxonche
python3 -m pip install --no-binary lxml html5-parser
- name: Checkout the pull request on Linux
if: matrix.os == 'ubuntu-20.04'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Get the latest releases (authenticated request on Linux)
if: ${{ matrix.os == 'ubuntu-20.04' && env.HAVE_ACCESS_TOKEN == 'true' }}
run: |
mkdir -p build
# Don’t attempt to use continuation lines here because Windows
curl --request GET --url https://api.github.com/repos/${{ github.repository }}/releases --header 'authorization: Bearer ${{ secrets.ACCESS_TOKEN }}' -o build/releases.json
- name: Build on Linux
if: matrix.os == 'ubuntu-20.04'
run: |
./gradlew -PrequireCompileSuccess=true dist