mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-02-07 17:02:29 +01:00
Allow testing dockerbuild changes in pull requests (#625)
This commit is contained in:
parent
fac4605e9b
commit
728d82f296
51
.github/workflows/build_and_test.yaml
vendored
51
.github/workflows/build_and_test.yaml
vendored
@ -23,8 +23,56 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
arch: ${{ matrix.arch }}
|
arch: ${{ matrix.arch }}
|
||||||
|
|
||||||
|
# This allows core contributors to test changes to the dockerbuild image within a pull request
|
||||||
|
linux_docker:
|
||||||
|
name: Linux docker
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
outputs:
|
||||||
|
docker-image: ${{ steps.docker.outputs.image }}
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}-dockerbuild-pr
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: "Get modified files"
|
||||||
|
id: changed_files
|
||||||
|
uses: tj-actions/changed-files@79adacd43ea069e57037edc891ea8d33013bc3da # v35
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
dockerbuild/*
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
if: steps.changed_files.outputs.any_modified == 'true'
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- id: docker
|
||||||
|
if: steps.changed_files.outputs.any_modified == 'true'
|
||||||
|
run: |
|
||||||
|
echo "image=$IMAGE:$PR" >> $GITHUB_OUTPUT
|
||||||
|
env:
|
||||||
|
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
PR: ${{ github.event.pull_request.number }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
if: steps.changed_files.outputs.any_modified == 'true'
|
||||||
|
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||||
|
with:
|
||||||
|
context: dockerbuild
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.docker.outputs.image }}
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
needs: fetch
|
needs:
|
||||||
|
- fetch
|
||||||
|
- linux_docker
|
||||||
name: Linux
|
name: Linux
|
||||||
uses: ./.github/workflows/build_linux.yaml
|
uses: ./.github/workflows/build_linux.yaml
|
||||||
strategy:
|
strategy:
|
||||||
@ -33,6 +81,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
|
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
|
||||||
sqlcipher: ${{ matrix.sqlcipher }}
|
sqlcipher: ${{ matrix.sqlcipher }}
|
||||||
|
docker-image: ${{ needs.linux_docker.outputs.docker-image }}
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
needs: fetch
|
needs: fetch
|
||||||
|
8
.github/workflows/build_linux.yaml
vendored
8
.github/workflows/build_linux.yaml
vendored
@ -20,11 +20,15 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
required: false
|
required: false
|
||||||
description: "Whether to arrange artifacts in the arrangement needed for deployment, skipping unrelated ones"
|
description: "Whether to arrange artifacts in the arrangement needed for deployment, skipping unrelated ones"
|
||||||
|
docker-image:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
description: "The docker image to use for the build, defaults to ghcr.io/vector-im/element-desktop-dockerbuild"
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/vector-im/element-desktop-dockerbuild:${{ github.ref_name == 'master' && 'master' || 'develop' }}
|
image: ${{ inputs.docker-image || format('ghcr.io/vector-im/element-desktop-dockerbuild:{0}', github.ref_name == 'master' && 'master' || 'develop') }}
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -39,7 +43,7 @@ jobs:
|
|||||||
id: cache
|
id: cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: ${{ runner.os }}-${{ inputs.sqlcipher }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
|
key: ${{ runner.os }}-${{ inputs.docker-image || github.ref_name }}-${{ inputs.sqlcipher }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
|
||||||
path: |
|
path: |
|
||||||
./.hak
|
./.hak
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user