Skip to content

Commit

Permalink
feat(ci): move to GitHub Actions (#1657)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel authored Oct 2, 2020
1 parent bc5db45 commit f85aabc
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 330 deletions.
130 changes: 130 additions & 0 deletions .github/workflows/ci.yml
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/

39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Then follow the steps below to clone the source code, install the dependencies a
git clone https://github.com/ipfs-shipyard/ipfs-desktop.git
cd ipfs-desktop
npm ci
npm build
npm start
```

Expand Down
27 changes: 0 additions & 27 deletions appveyor.yml

This file was deleted.

Loading

0 comments on commit f85aabc

Please sign in to comment.