aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-06-08 04:47:40 +0530
committerLibravatar GitHub <noreply@github.com>2021-06-08 04:47:40 +0530
commit76b9acc16543e873ba647c847b37a3e12ec20b11 (patch)
tree23fdedffcf8ee7435a76ba0e91b64ad05501075f /.github
parentNew translations en-US.json (Korean) (diff)
downloadferdium-app-76b9acc16543e873ba647c847b37a3e12ec20b11.tar.gz
ferdium-app-76b9acc16543e873ba647c847b37a3e12ec20b11.tar.zst
ferdium-app-76b9acc16543e873ba647c847b37a3e12ec20b11.zip
Builds using GitHub actions (#1467)
* Using GH Actions for building, packaging and publishing for all 3 OSes (macos, ubuntu and windows). Handles PR builds, release builds, scheduled nightly builds and manual triggering from the web-ui. * Removed references to travis and appveyor and their respective config files. * Added ability to force rebuild nightlies without new version number. (This should allow us to rerun nightly builds with the same build number. Looks for the trigger comment to contain: 'force build' and 'nightly branch')
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ferdi-builds.yml206
1 files changed, 206 insertions, 0 deletions
diff --git a/.github/workflows/ferdi-builds.yml b/.github/workflows/ferdi-builds.yml
new file mode 100644
index 000000000..199c3ca25
--- /dev/null
+++ b/.github/workflows/ferdi-builds.yml
@@ -0,0 +1,206 @@
1# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
4# Note: This workflow requires some secrets setup, and set on this repo with the names:
5 # 'FERDI_PUBLISH_TOKEN' (A GitHub Personal Access Token with appropriate permissions - for publishing the built artifacts)
6 # 'APPLEID' (The username of your Apple developer account - for notarizing the mac artifacts)
7 # 'APPLEID_PASSWORD' (An app-specific password - for notarizing the mac artifacts)
8 # 'CSC_LINK' (The HTTPS link or local path to certificate - for code signing of mac and windows artifacts)
9 # 'CSC_KEY_PASSWORD' (The password to decrypt the certificate given in CSC_LINK - for code signing of mac and windows artifacts)
10
11name: Ferdi Builds
12
13on:
14 # Push to any tracked branches
15 push:
16 branches: [develop, release, nightly]
17 # PRs only on develop branch
18 pull_request:
19 branches: [develop]
20 # Manual trigger from the UI
21 workflow_dispatch:
22 inputs:
23 message:
24 description: 'Message for build'
25 required: true
26 schedule:
27 - cron: '0 0 * * *' # every night at 12 am
28
29env:
30 USE_HARD_LINKS: false
31 # DEBUG: electron-builder
32
33jobs:
34 check_date:
35 runs-on: ubuntu-latest
36 name: Check latest commit
37 outputs:
38 should_run: ${{ steps.should_run.outputs.should_run }}
39 steps:
40 - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled'
41 uses: actions/checkout@v2
42 with:
43 ref: nightly
44 submodules: recursive
45 fetch-depth: 0
46 - name: Print latest commit
47 run: echo ${{ github.sha }}
48 - name: Setup git configs
49 run: |
50 git config user.name github-actions
51 git config user.email github-actions@github.com
52 - name: Merge from 'origin/develop' (continue if errored)
53 if: ${{ github.event_name == 'schedule' }}
54 continue-on-error: true
55 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)
57 if: ${{ github.event_name == 'schedule' }}
58 continue-on-error: true
59 run: |
60 echo "Updating submodules"
61 git submodule update --remote -f
62
63 echo "Committing submodules"
64 git commit -am "Update submodules" --no-verify || true
65
66 echo "Running linter and tests"
67 npm run lint && npm run test
68
69 echo "Committing linter fixes"
70 git commit -am "Apply linter fixes" --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
74 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' }}
76 run: |
77 CHANGES_COUNT=$(git diff --shortstat origin/nightly | wc -l)
78 echo "Number of changes: $CHANGES_COUNT"
79 if [ $CHANGES_COUNT -eq 0 ] && [ $FORCE_REBUILD != "true" ]; then
80 echo "No changes found - terminating the build"
81 echo "::set-output name=should_run::false"
82 else
83 if [ $FORCE_REBUILD != "true" ]; then
84 echo "Bumping version number"
85 npm version prerelease --preid=nightly
86 fi
87
88 echo "Pushing merge, linter, submodule and version-bump commits"
89 git push origin nightly --no-verify
90 fi
91
92 build:
93 name: '${{ matrix.os }}'
94 needs: check_date
95 if: ${{ needs.check_date.outputs.should_run != 'false' }}
96 runs-on: ${{ matrix.os }}
97 strategy:
98 matrix:
99 os: [macos-10.15, ubuntu-20.04, windows-2019]
100 node-version: [14.16.1]
101 fail-fast: false
102 steps:
103 - name: Set env vars for macOS and Linux
104 if: startsWith(runner.os, 'macOS') || startsWith(runner.os, 'Linux')
105 run: |
106 echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV
107 echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV
108 echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV
109 echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
110 - name: Set env vars for Windows
111 if: startsWith(runner.os, 'Windows')
112 run: |
113 echo "HOME=$USERPROFILE" >> $GITHUB_ENV
114 echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV
115 echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV
116 echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV
117 echo "FORCE_REBUILD_ON_NIGHTLY=${{ contains(github.event.inputs.message, 'force build') && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
118 shell: bash
119 - 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
120 uses: actions/checkout@v2
121 if: ${{ github.event_name == 'schedule' || env.FORCE_REBUILD_ON_NIGHTLY == 'true' }}
122 with:
123 submodules: recursive
124 ref: nightly
125 - 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
126 uses: actions/checkout@v2
127 if: ${{ github.event_name != 'schedule' && env.FORCE_REBUILD_ON_NIGHTLY != 'true' }}
128 with:
129 submodules: recursive
130 - name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off)
131 run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
132 shell: bash
133 - name: Cache node modules
134 uses: actions/cache@v2
135 env:
136 cache-name: cache-node-modules
137 with:
138 path: ${{ env.NPM_CACHE }}
139 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
140 restore-keys: |
141 ${{ runner.os }}-build-${{ env.cache-name }}-
142 ${{ runner.os }}-build-
143 ${{ runner.os }}-
144 - name: Cache electron modules
145 uses: actions/cache@v2
146 env:
147 cache-name: cache-electron-modules
148 with:
149 key: ${{ runner.os }}-${{ env.cache-name }}
150 path: ${{ env.ELECTRON_CACHE }}
151 - name: Cache electron-builder modules
152 uses: actions/cache@v2
153 env:
154 cache-name: cache-electron-builder-modules
155 with:
156 key: ${{ runner.os }}-${{ env.cache-name }}
157 path: ${{ env.ELECTRON_BUILDER_CACHE }}
158 - name: Use Node.js ${{ matrix.node-version }}
159 uses: actions/setup-node@v2
160 with:
161 node-version: ${{ matrix.node-version }}
162 - name: Upgrade Xcode version on the macOS 10.15 default runners provided by GH Actions
163 if: startsWith(runner.os, 'macOS')
164 run: |
165 sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*
166 sudo xcode-select -s "/Applications/Xcode_12.4.app"
167 - name: Uninstall locally and reinstall node-gyp globally
168 if: startsWith(runner.os, 'macOS') || startsWith(runner.os, 'Linux')
169 run: |
170 npm uninstall node-gyp
171 npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)"
172 - name: Install node dependencies recursively
173 run: npx lerna bootstrap
174 - name: Package recipes
175 run: npm i && npm run package
176 working-directory: ./recipes
177 - name: Run linter and tests
178 run: npm run lint && npm run test
179 - name: Build Ferdi without publish for any branch not 'nightly' and not 'release'
180 if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }}
181 run: npm run build
182 shell: bash
183 - name: Build Ferdi with publish for 'nightly' branch
184 if: ${{ env.GIT_BRANCH_NAME == 'nightly' }}
185 run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies
186 shell: bash
187 env:
188 GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
189 APPLEID: ${{ secrets.APPLEID }}
190 APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }}
191 CSC_LINK: ${{ secrets.CSC_LINK }}
192 CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
193 WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
194 WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
195 - name: Build Ferdi with publish for 'release' branch
196 if: ${{ env.GIT_BRANCH_NAME == 'release' }}
197 run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi
198 shell: bash
199 env:
200 GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
201 APPLEID: ${{ secrets.APPLEID }}
202 APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }}
203 CSC_LINK: ${{ secrets.CSC_LINK }}
204 CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
205 WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
206 WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}