diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f87f6c1..28972ef 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/.github/workflows/build_linux.yaml b/.github/workflows/build_linux.yaml index 959565c..1cf5ed6 100644 --- a/.github/workflows/build_linux.yaml +++ b/.github/workflows/build_linux.yaml @@ -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 diff --git a/.github/workflows/build_macos.yaml b/.github/workflows/build_macos.yaml index 193a6d2..a3000e7 100644 --- a/.github/workflows/build_macos.yaml +++ b/.github/workflows/build_macos.yaml @@ -2,7 +2,6 @@ on: workflow_call: jobs: build: - name: Universal runs-on: macos-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build_prepare.yaml b/.github/workflows/build_prepare.yaml index 92d6317..0ce46a1 100644 --- a/.github/workflows/build_prepare.yaml +++ b/.github/workflows/build_prepare.yaml @@ -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: diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml index bb71a29..6bbcfb2 100644 --- a/.github/workflows/build_windows.yaml +++ b/.github/workflows/build_windows.yaml @@ -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