Improve workflow reuse (#452)

This commit is contained in:
Michael Telatynski 2022-11-14 11:09:07 +00:00 committed by GitHub
parent 1e6a3ceebd
commit d45b3aac65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 31 deletions

View file

@ -9,16 +9,29 @@ concurrency:
jobs:
fetch:
uses: ./.github/workflows/build_prepare.yaml
with:
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
version: ${{ github.event.pull_request.base.ref == 'develop' && 'develop' || '' }}
windows:
needs: fetch
name: Windows
uses: ./.github/workflows/build_windows.yaml
strategy:
matrix:
arch: [ x64, x86 ]
with:
arch: ${{ matrix.arch }}
linux:
needs: fetch
name: Linux
uses: ./.github/workflows/build_linux.yaml
strategy:
matrix:
sqlcipher: [ system, static ]
with:
sqlcipher: ${{ matrix.sqlcipher }}
macos:
needs: fetch

View file

@ -1,14 +1,12 @@
on:
workflow_call:
inputs:
sqlcipher:
type: string
required: true
description: "How to link sqlcipher, one of 'system' | 'static'"
jobs:
build:
strategy:
matrix:
include:
- sqlcipher: system
- sqlcipher: static
static: 1
name: '${{ matrix.sqlcipher }} sqlcipher'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -30,7 +28,7 @@ jobs:
toolchain: stable
- name: Install libsqlcipher-dev
if: matrix.sqlcipher == 'system'
if: inputs.sqlcipher == 'system'
run: sudo apt-get install -y libsqlcipher-dev
- uses: actions/setup-node@v3
@ -44,7 +42,7 @@ jobs:
- name: Build Natives
run: "yarn build:native"
env:
SQLCIPHER_STATIC: ${{ matrix.static }}
SQLCIPHER_STATIC: ${{ inputs.sqlcipher == 'static' && '1' || '' }}
- name: Build App
run: "yarn build --publish never"
@ -55,6 +53,6 @@ jobs:
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: linux-sqlcipher-${{ matrix.sqlcipher }}
name: linux-sqlcipher-${{ inputs.sqlcipher }}
path: dist
retention-days: 1

View file

@ -2,7 +2,6 @@ on:
workflow_call:
jobs:
build:
name: Universal
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

View file

@ -1,5 +1,14 @@
on:
workflow_call:
inputs:
config:
type: string
required: true
description: "The config directory to use"
version:
type: string
required: false
description: "The version tag to fetch, or 'develop', will pick automatically if not passed"
jobs:
prepare:
name: Prepare
@ -14,13 +23,8 @@ jobs:
- name: Install Deps
run: "yarn install --pure-lockfile"
- name: Fetch Element Web (develop)
if: github.event.pull_request.base.ref == 'develop'
run: yarn run fetch --noverify develop -d element.io/nightly
- name: Fetch Element Web
if: github.event.pull_request.base.ref != 'develop'
run: yarn run fetch --noverify --cfgdir element.io/release
run: yarn run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
- uses: actions/upload-artifact@v3
with:

View file

@ -1,18 +1,30 @@
on:
workflow_call:
inputs:
arch:
type: string
required: true
description: "The architecture to build for, one of 'x64' | 'x86'"
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
arch: x64
- target: i686-pc-windows-msvc
arch: x86
build-args: --ia32
name: ${{ matrix.arch }}
runs-on: windows-latest
steps:
- uses: kanga333/variable-mapper@master
id: config
with:
key: "${{ inputs.arch }}"
export_to: output
map: |
{
"x64": {
"target": "x86_64-pc-windows-msvc"
},
"x86": {
"target": "i686-pc-windows-msvc",
"build-args": "--ia32"
}
}
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
@ -29,7 +41,7 @@ jobs:
- name: Set up build tools
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
arch: ${{ inputs.arch }}
# ActiveTCL package on choco is from 2015,
# this one is newer but includes more than we need
@ -49,7 +61,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
target: ${{ steps.config.outputs.target }}
- uses: actions/setup-node@v3
with:
@ -62,14 +74,14 @@ jobs:
- name: Build Natives
run: |
refreshenv
yarn build:native --target ${{ matrix.target }}
yarn build:native --target ${{ steps.config.outputs.target }}
- name: Build App
run: "yarn build --publish never -w ${{ matrix.build-args }}"
run: "yarn build --publish never -w ${{ steps.config.outputs.build-args }}"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: win-${{ matrix.arch }}
name: win-${{ inputs.arch }}
path: dist
retention-days: 1