aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-06-16 09:54:56 +0000
committerLibravatar GitHub <noreply@github.com>2021-06-16 11:54:56 +0200
commitcc5c4df18803dde250613fa841212dcf03ce2bf1 (patch)
treea361b4e84da73c606879fe373eb2478b978eb4bd
parentAdded ability to run specific OS builds for manual trigger (diff)
downloadferdi-cc5c4df18803dde250613fa841212dcf03ce2bf1.tar.gz
ferdi-cc5c4df18803dde250613fa841212dcf03ce2bf1.tar.zst
ferdi-cc5c4df18803dde250613fa841212dcf03ce2bf1.zip
Run ALL builds if no OSes were chosen (manual trigger) (#1529)
Manual trigger no longer looks for 'force build' magic message content. Only run 'check_updates' for nightly branch (for either schedule or manual trigger) Optimizing build: 1) git checkout fetch depth 2) better conditions for skipping builds
-rw-r--r--.github/workflows/ferdi-builds.yml96
1 files changed, 76 insertions, 20 deletions
diff --git a/.github/workflows/ferdi-builds.yml b/.github/workflows/ferdi-builds.yml
index bf6b6140..c466e9d0 100644
--- a/.github/workflows/ferdi-builds.yml
+++ b/.github/workflows/ferdi-builds.yml
@@ -33,28 +33,78 @@ env:
33jobs: 33jobs:
34 check_updates: 34 check_updates:
35 runs-on: ubuntu-latest 35 runs-on: ubuntu-latest
36 name: Check latest commit 36 name: 'Check latest commit: ${{ github.event.inputs.message }}'
37 outputs: 37 outputs:
38 should_run: ${{ steps.should_run.outputs.should_run }} 38 should_run: ${{ steps.should_run.outputs.should_run }}
39 steps: 39 steps:
40 - name: Set env vars
41 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
42 run: |
43 echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV
44 echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV
45 echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV
40 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' 46 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled'
41 uses: actions/checkout@v2 47 uses: actions/checkout@v2
48 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
42 with: 49 with:
43 ref: nightly 50 ref: nightly
44 submodules: recursive 51 submodules: recursive
45 fetch-depth: 0 52 fetch-depth: 0
53 - name: Cache node modules
54 uses: actions/cache@v2
55 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
56 env:
57 cache-name: cache-node-modules
58 with:
59 path: ${{ env.NPM_CACHE }}
60 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
61 restore-keys: |
62 ${{ runner.os }}-build-${{ env.cache-name }}-
63 ${{ runner.os }}-build-
64 ${{ runner.os }}-
65 - name: Cache electron modules
66 uses: actions/cache@v2
67 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
68 env:
69 cache-name: cache-electron-modules
70 with:
71 key: ${{ runner.os }}-${{ env.cache-name }}
72 path: ${{ env.ELECTRON_CACHE }}
73 - name: Cache electron-builder modules
74 uses: actions/cache@v2
75 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
76 env:
77 cache-name: cache-electron-builder-modules
78 with:
79 key: ${{ runner.os }}-${{ env.cache-name }}
80 path: ${{ env.ELECTRON_BUILDER_CACHE }}
81 - name: Use Node.js 14.16.1
82 uses: actions/setup-node@v2
83 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
84 with:
85 node-version: 14.16.1
86 - name: Uninstall locally and reinstall node-gyp globally
87 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
88 run: |
89 npm uninstall node-gyp
90 npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)"
91 - name: Install node dependencies recursively
92 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
93 run: npx lerna bootstrap
46 - name: Print latest commit 94 - name: Print latest commit
95 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
47 run: echo ${{ github.sha }} 96 run: echo ${{ github.sha }}
48 - name: Setup git configs 97 - name: Setup git configs
98 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
49 run: | 99 run: |
50 git config user.name github-actions 100 git config user.name github-actions
51 git config user.email github-actions@github.com 101 git config user.email github-actions@github.com
52 - name: Merge from 'origin/develop' (continue if errored) 102 - name: Merge from 'origin/develop' (continue if errored)
53 if: ${{ github.event_name == 'schedule' }} 103 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
54 continue-on-error: true 104 continue-on-error: true
55 run: git merge --no-ff --no-verify --commit -m "Merge remote-tracking branch 'origin/develop' into HEAD" origin/develop 105 run: git merge --no-ff --no-verify --commit -m "Merge remote-tracking branch 'origin/develop' into HEAD" origin/develop
56 - name: Update submodules (continue if errored) 106 - name: Update submodules (continue if errored)
57 if: ${{ github.event_name == 'schedule' }} 107 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
58 continue-on-error: true 108 continue-on-error: true
59 run: | 109 run: |
60 echo "Updating submodules" 110 echo "Updating submodules"
@@ -68,19 +118,19 @@ jobs:
68 echo "Updating browserslist db" 118 echo "Updating browserslist db"
69 npx browserslist@latest --update-db 119 npx browserslist@latest --update-db
70 git commit -am "Apply browserslist data updates" --no-verify || true 120 git commit -am "Apply browserslist data updates" --no-verify || true
71 - name: Capture if this is a manually triggered forced rebuild
72 run: echo "FORCE_REBUILD=${{ contains(github.event.inputs.message, 'force build') }}" >> $GITHUB_ENV
73 - id: should_run 121 - id: should_run
74 name: Check whether there are any commits since this run was last triggered and either push or set the output 122 name: Check whether there are any commits since this run was last triggered and either push or set the output
75 if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD == 'true' }} 123 if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
76 run: | 124 run: |
77 CHANGES_COUNT=$(git diff --shortstat origin/nightly | wc -l) 125 CHANGES_COUNT=$(git diff --shortstat origin/nightly | wc -l)
126 MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}"
78 echo "Number of changes: $CHANGES_COUNT" 127 echo "Number of changes: $CHANGES_COUNT"
79 if [ $CHANGES_COUNT -eq 0 ] && [ $FORCE_REBUILD != "true" ]; then 128 if [ $CHANGES_COUNT -eq 0 ] && [ $MANUAL_REBUILD != "true" ]; then
80 echo "No changes found - terminating the build" 129 echo "No changes found - terminating the build"
81 echo "::set-output name=should_run::false" 130 echo "::set-output name=should_run::false"
82 else 131 else
83 if [ $FORCE_REBUILD != "true" ] || [ "${{ contains(github.event.inputs.message, 'version bump') }}" == "true" ]; then 132 # changes > 0 (or) MANUAL_REBUILD=true
133 if [ $MANUAL_REBUILD != "true" ] || [ "${{ contains(github.event.inputs.message, 'version bump') }}" == "true" ]; then
84 echo "Bumping version number" 134 echo "Bumping version number"
85 npm version prerelease --preid=nightly 135 npm version prerelease --preid=nightly
86 fi 136 fi
@@ -92,7 +142,7 @@ jobs:
92 build_mac: 142 build_mac:
93 name: 'macos ${{ github.event.inputs.message }}' 143 name: 'macos ${{ github.event.inputs.message }}'
94 needs: check_updates 144 needs: check_updates
95 if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || contains(github.event.inputs.message, 'macOS')) }} 145 if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'macOS') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }}
96 runs-on: macos-10.15 146 runs-on: macos-10.15
97 steps: 147 steps:
98 - name: Set env vars 148 - name: Set env vars
@@ -100,19 +150,21 @@ jobs:
100 echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV 150 echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV
101 echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV 151 echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV
102 echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV 152 echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV
103 echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV 153 echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
104 echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV 154 echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV
105 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch 155 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch
106 uses: actions/checkout@v2 156 uses: actions/checkout@v2
107 if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }} 157 if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }}
108 with: 158 with:
109 submodules: recursive 159 submodules: recursive
110 ref: nightly 160 ref: nightly
161 fetch-depth: 0
111 - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch 162 - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch
112 uses: actions/checkout@v2 163 uses: actions/checkout@v2
113 if: ${{ github.event_name != 'schedule' && env.FORCE_REBUILD_ON_NIGHTLY != 'true' }} 164 if: ${{ github.event_name != 'schedule' && env.MANUAL_REBUILD_ON_NIGHTLY != 'true' }}
114 with: 165 with:
115 submodules: recursive 166 submodules: recursive
167 fetch-depth: 0
116 - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off) 168 - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off)
117 run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV 169 run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
118 shell: bash 170 shell: bash
@@ -192,7 +244,7 @@ jobs:
192 build_linux: 244 build_linux:
193 name: 'ubuntu ${{ github.event.inputs.message }}' 245 name: 'ubuntu ${{ github.event.inputs.message }}'
194 needs: check_updates 246 needs: check_updates
195 if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || contains(github.event.inputs.message, 'Linux')) }} 247 if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'Linux') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }}
196 runs-on: ubuntu-20.04 248 runs-on: ubuntu-20.04
197 steps: 249 steps:
198 - name: Set env vars 250 - name: Set env vars
@@ -200,19 +252,21 @@ jobs:
200 echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV 252 echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV
201 echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV 253 echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV
202 echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV 254 echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV
203 echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV 255 echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
204 echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV 256 echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV
205 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch 257 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch
206 uses: actions/checkout@v2 258 uses: actions/checkout@v2
207 if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }} 259 if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }}
208 with: 260 with:
209 submodules: recursive 261 submodules: recursive
210 ref: nightly 262 ref: nightly
263 fetch-depth: 0
211 - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch 264 - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch
212 uses: actions/checkout@v2 265 uses: actions/checkout@v2
213 if: ${{ github.event_name != 'schedule' && env.FORCE_REBUILD_ON_NIGHTLY != 'true' }} 266 if: ${{ github.event_name != 'schedule' && env.MANUAL_REBUILD_ON_NIGHTLY != 'true' }}
214 with: 267 with:
215 submodules: recursive 268 submodules: recursive
269 fetch-depth: 0
216 - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off) 270 - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off)
217 run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV 271 run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
218 shell: bash 272 shell: bash
@@ -278,7 +332,7 @@ jobs:
278 build_windows: 332 build_windows:
279 name: 'windows ${{ github.event.inputs.message }}' 333 name: 'windows ${{ github.event.inputs.message }}'
280 needs: check_updates 334 needs: check_updates
281 if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || contains(github.event.inputs.message, 'Windows')) }} 335 if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'Windows') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }}
282 runs-on: windows-2019 336 runs-on: windows-2019
283 steps: 337 steps:
284 - name: Set env vars 338 - name: Set env vars
@@ -287,20 +341,22 @@ jobs:
287 echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV 341 echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV
288 echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV 342 echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV
289 echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV 343 echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV
290 echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV 344 echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
291 echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV 345 echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV
292 shell: bash 346 shell: bash
293 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch 347 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch
294 uses: actions/checkout@v2 348 uses: actions/checkout@v2
295 if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }} 349 if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }}
296 with: 350 with:
297 submodules: recursive 351 submodules: recursive
298 ref: nightly 352 ref: nightly
353 fetch-depth: 0
299 - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch 354 - name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch
300 uses: actions/checkout@v2 355 uses: actions/checkout@v2
301 if: ${{ github.event_name != 'schedule' && env.FORCE_REBUILD_ON_NIGHTLY != 'true' }} 356 if: ${{ github.event_name != 'schedule' && env.MANUAL_REBUILD_ON_NIGHTLY != 'true' }}
302 with: 357 with:
303 submodules: recursive 358 submodules: recursive
359 fetch-depth: 0
304 - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off) 360 - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off)
305 run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV 361 run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
306 shell: bash 362 shell: bash