Skip to content

[Tech] Deduplicate our Workflows #3198

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

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Prerequisite setup'
description: 'Installs dependencies (Node itself, node_modules, node-gyp)'
runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install node-gyp
run: npm install --global node-gyp
shell: bash
- name: Install modules
run: npm install --legacy-peer-deps
shell: bash
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
60 changes: 60 additions & 0 deletions .github/workflows/build-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build Heroic, upload artifacts

on:
workflow_call:
inputs:
publish-snap:
required: false
type: boolean
secrets:
workflowToken:
required: true
snapcraftIdEdge:
required: false

jobs:
build:
strategy:
matrix:
os: [windows-2022, ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-deps
- name: Build Windows Portable version
run: yarn dist:win portable
if: runner.os == 'Windows'
- name: Build macOS x64 & arm64 versions
run: yarn dist:mac --x64 --arm64 --publish=never
env:
GITHUB_TOKEN: ${{ secrets.workflowToken }}
GH_TOKEN: ${{ secrets.workflowToken }}
CSC_IDENTITY_AUTO_DISCOVERY: false
if: runner.os == 'macOS'
- name: Build and publish Snap version
run: |
sudo apt-get install --no-install-recommends -y snapcraft
yarn dist:linux Snap --publish=always
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.snapcraftEdgeId }}
if: runner.os == 'Linux' && inputs.publish-snap
- name: Build AppImage version
run: yarn dist:linux AppImage
if: runner.os == 'Linux'
- name: Upload built version
uses: actions/upload-artifact@v3
with:
name: ${{ (matrix.os == 'windows-2022' && 'win-portable' ) ||
(matrix.os == 'macos-12' && 'mac-x64' ) ||
(matrix.os == 'ubuntu-22.04' && 'linux-AppImage') }}
path: ${{ (matrix.os == 'windows-2022' && 'dist/Heroic*.exe' ) ||
(matrix.os == 'macos-12' && 'dist/Heroic*x64.dmg' ) ||
(matrix.os == 'ubuntu-22.04' && 'dist/Heroic-*.AppImage') }}
retention-days: 14
- name: Upload macOS ARM version
uses: actions/upload-artifact@v3
with:
name: mac-arm64
path: dist/Heroic*arm64.dmg
retention-days: 14
if: runner.os == 'macOS'
17 changes: 17 additions & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build on main/stable push

on:
push:
branches: [main, stable]
tags:
- '!v*'
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/build-base.yml
with:
publish-snap: true
secrets:
snapcraftIdEdge: ${{ secrets.SNAPCRAFT_ID_EDGE }}
workflowToken: ${{ secrets.WORKFLOW_TOKEN }}
45 changes: 0 additions & 45 deletions .github/workflows/build-prs-linux.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/build-prs-mac.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/build-prs-windows.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build on PR

on:
pull_request:
branches: [main, stable]
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/build-base.yml
with:
publish-snap: false
secrets:
workflowToken: ${{ secrets.WORKFLOW_TOKEN }}
92 changes: 0 additions & 92 deletions .github/workflows/build.yml

This file was deleted.

9 changes: 1 addition & 8 deletions .github/workflows/codecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install node-gyp.
run: yarn global add node-gyp
- name: Install modules.
run: yarn install --frozen-lockfile
- uses: ./.github/actions/install-deps
- name: Check Typescript syntax
run: yarn codecheck
7 changes: 1 addition & 6 deletions .github/workflows/draft-release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ jobs:
steps:
- run: sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm snapcraft
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: install node-gyp
run: npm install -g node-gyp
- run: npm i --legacy-peer-deps
- uses: ./.github/actions/install-deps
- run: npm run release:linux
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/draft-release-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: install node-gyp
run: npm install -g node-gyp
- uses: ./.github/actions/install-deps
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: python3 -m pip install castlabs-evs
- run: npm i --legacy-peer-deps
- run: npm run release:mac
7 changes: 1 addition & 6 deletions .github/workflows/draft-release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: install node-gyp
run: npm install -g node-gyp
- uses: ./.github/actions/install-deps
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: python3 -m pip install castlabs-evs
- run: npm install --legacy-peer-deps
- run: npm run release:win
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
Expand Down
Loading