-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ci): move to GitHub Actions #1657
Merged
+338
−330
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6fcaea4
fix(ci): output files locked on MS Windows
lidel 496bba6
refactor(ci): run only one Windows job at a time
lidel af6fe86
chore: hide appveyor config
lidel c88f8df
chore: enable signing on branch
lidel 556108a
refactor: extract packaging into separate step
lidel d57b997
feat(ci): build windows packages via gh action
lidel 53c56fa
refactor(ci): run build before e2e
lidel fb20c6d
feat(ci): add cache
lidel e104ba9
feat(ci): persist artifacts from dist/
lidel 222d015
feat(ci): build linux on gh
lidel 23944c4
feat(ci): build mac on gh
lidel 70d7a2b
feat(ci): separate test and build
lidel 889f768
fix(cid): disable fail fast
lidel 774f61b
feat(ci): run on pull_request event
lidel dcb71ac
feat(ci): upload pkgs to release draft only on tag
lidel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: ci | ||
on: [push, pull_request] | ||
|
||
env: | ||
XDG_CACHE_HOME: ${{ github.workspace }}/.cache | ||
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron | ||
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v1 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Cache bigger downloads | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ github.workspace }}/.cache | ||
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }} | ||
${{ runner.os }}- | ||
|
||
- name: Install dependencies | ||
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Test | ||
run: npm run test | ||
|
||
- name: Test end-to-end | ||
uses: GabrielBB/xvfb-action@f040be23a619e5ec34116f24098ad3626ceab681 # v1.4 | ||
with: | ||
working-directory: ${{ github.workspace }} | ||
run: npm run test:e2e | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
build: | ||
runs-on: ${{ matrix.os }} | ||
needs: test # build packages only if tests passed | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v1 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Cache bigger downloads | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ github.workspace }}/.cache | ||
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }} | ||
${{ runner.os }}- | ||
|
||
- name: Install dependencies | ||
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Get tag | ||
id: tag | ||
uses: dawidd6/action-get-tag@12319896edaa290b27558e34a177804e9b8d077b # v1 | ||
continue-on-error: true # empty steps.tag.outputs.tag will inform the next step | ||
|
||
- name: Build binaries with electron-builder | ||
uses: samuelmeuli/action-electron-builder@92327c67bc45ff7c38bf55d8aa8c4d75b7ea38e7 # v1.6.0 but safer than a tag that can be changed | ||
with: | ||
args: --publish onTag # attach signed binaries to a release draft only when building a tag | ||
release: false # keep github release as draft for manual inspection | ||
max_attempts: 2 | ||
# GH token for attaching atrifacts to release draft on tag build | ||
github_token: ${{ secrets.github_token }} | ||
# Windows signing | ||
windows_certs: ${{ secrets.windows_certs }} | ||
windows_certs_password: ${{ secrets.windows_certs_password }} | ||
# Apple signing | ||
mac_certs: ${{ secrets.mac_certs }} | ||
mac_certs_password: ${{ secrets.mac_certs_password }} | ||
# TODO: secrets forsnap, chocolatey | ||
env: | ||
CI_BUILD_TAG: ${{steps.tag.outputs.tag}} # used by --publish onTag | ||
# Apple notarization | ||
APPLEID: ${{ secrets.apple_id }} | ||
APPLEIDPASS: ${{ secrets.apple_id_pass }} | ||
|
||
- name: Show dist/ | ||
run: du -sh dist/ && ls -l dist/ | ||
|
||
# Persist produced binaries and effective config used for building them | ||
# - this is not for releases, but for quick testing during the dev | ||
# - action artifacts can be downloaded for 90 days, then are removed by github | ||
# - binaries in PRs from forks won't be signed | ||
- name: Attach produced packages to Github Action | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: dist-${{ matrix.os }} | ||
path: dist/*esktop*.* | ||
if-no-files-found: error | ||
|
||
- name: Show Cache | ||
run: du -sh ${{ github.workspace }}/.cache/ && ls -l ${{ github.workspace }}/.cache/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why lint so late? is deliberate? could go before build to fail fast on trivial errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be just my personal preference: I find it more friendly to do linting later,
that way we see that contributed PR passes tests and only need linting fixes (which could be trivial), which makes it easier to evaluate contribution.