diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000000..af7ed21fce
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,72 @@
+# GitHub actions workflow which builds and publishes the docker images.
+
+name: Build docker images
+
+on:
+ push:
+ tags: ["v*"]
+ branches: [ master, main ]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up QEMU
+ id: qemu
+ uses: docker/setup-qemu-action@v1
+ with:
+ platforms: arm64
+
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v1
+
+ - name: Inspect builder
+ run: docker buildx inspect
+
+ - name: Log in to DockerHub
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Calculate docker image tag
+ id: set-tag
+ run: |
+ case "${GITHUB_REF}" in
+ refs/heads/master|refs/heads/main)
+ tag=latest
+ ;;
+ refs/tags/*)
+ tag=${GITHUB_REF#refs/tags/}
+ ;;
+ *)
+ tag=${GITHUB_SHA}
+ ;;
+ esac
+ echo "::set-output name=tag::$tag"
+
+ # for release builds, we want to get the amd64 image out asap, so first
+ # we do an amd64-only build, before following up with a multiarch build.
+ - name: Build and push amd64
+ uses: docker/build-push-action@v2
+ if: "${{ startsWith(github.ref, 'refs/tags/v') }}"
+ with:
+ push: true
+ labels: "gitsha1=${{ github.sha }}"
+ tags: "matrixdotorg/synapse:${{ steps.set-tag.outputs.tag }}"
+ file: "docker/Dockerfile"
+ platforms: linux/amd64
+
+ - name: Build and push all platforms
+ uses: docker/build-push-action@v2
+ with:
+ push: true
+ labels: "gitsha1=${{ github.sha }}"
+ tags: "matrixdotorg/synapse:${{ steps.set-tag.outputs.tag }}"
+ file: "docker/Dockerfile"
+ platforms: linux/amd64,linux/arm64
diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml
index f292d703ed..325c1f7d39 100644
--- a/.github/workflows/release-artifacts.yml
+++ b/.github/workflows/release-artifacts.yml
@@ -3,28 +3,33 @@
name: Build release artifacts
on:
+ # we build on PRs and develop to (hopefully) get early warning
+ # of things breaking (but only build one set of debs)
+ pull_request:
push:
- # we build on develop and release branches to (hopefully) get early warning
- # of things breaking
- branches: ["develop", "release-*"]
+ branches: ["develop"]
- # we also rebuild on tags, so that we can be sure of picking the artifacts
- # from the right tag.
+ # we do the full build on tags.
tags: ["v*"]
permissions:
contents: write
jobs:
- # first get the list of distros to build for.
get-distros:
+ name: "Calculate list of debian distros"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- id: set-distros
run: |
- echo "::set-output name=distros::$(scripts-dev/build_debian_packages --show-dists-json)"
+ # if we're running from a tag, get the full list of distros; otherwise just use debian:sid
+ dists='["debian:sid"]'
+ if [[ $GITHUB_REF == refs/tags/* ]]; then
+ dists=$(scripts-dev/build_debian_packages --show-dists-json)
+ fi
+ echo "::set-output name=distros::$dists"
# map the step outputs to job outputs
outputs:
distros: ${{ steps.set-distros.outputs.distros }}
@@ -66,7 +71,7 @@ jobs:
# if it's a tag, create a release and attach the artifacts to it
attach-assets:
name: "Attach assets to release"
- if: startsWith(github.ref, 'refs/tags/')
+ if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
needs:
- build-debs
- build-sdist
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index bf36ee1cdf..cef4439477 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -65,14 +65,14 @@ jobs:
# Dummy step to gate other tests on without repeating the whole list
linting-done:
- if: ${{ always() }} # Run this even if prior jobs were skipped
+ if: ${{ !cancelled() }} # Run this even if prior jobs were skipped
needs: [lint, lint-crlf, lint-newsfile, lint-sdist]
runs-on: ubuntu-latest
steps:
- run: "true"
trial:
- if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail
+ if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
needs: linting-done
runs-on: ubuntu-latest
strategy:
@@ -131,7 +131,7 @@ jobs:
|| true
trial-olddeps:
- if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail
+ if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
needs: linting-done
runs-on: ubuntu-latest
steps:
@@ -156,7 +156,7 @@ jobs:
trial-pypy:
# Very slow; only run if the branch name includes 'pypy'
- if: ${{ contains(github.ref, 'pypy') && !failure() }}
+ if: ${{ contains(github.ref, 'pypy') && !failure() && !cancelled() }}
needs: linting-done
runs-on: ubuntu-latest
strategy:
@@ -185,7 +185,7 @@ jobs:
|| true
sytest:
- if: ${{ !failure() }}
+ if: ${{ !failure() && !cancelled() }}
needs: linting-done
runs-on: ubuntu-latest
container:
@@ -245,7 +245,7 @@ jobs:
/logs/**/*.log*
portdb:
- if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail
+ if: ${{ !failure() && !cancelled() }} # Allow previous steps to be skipped, but not fail
needs: linting-done
runs-on: ubuntu-latest
strategy:
@@ -286,7 +286,7 @@ jobs:
- run: .buildkite/scripts/test_synapse_port_db.sh
complement:
- if: ${{ !failure() }}
+ if: ${{ !failure() && !cancelled() }}
needs: linting-done
runs-on: ubuntu-latest
container:
@@ -344,3 +344,15 @@ jobs:
env:
COMPLEMENT_BASE_IMAGE: complement-synapse:latest
working-directory: complement
+
+ # a job which marks all the other jobs as complete, thus allowing PRs to be merged.
+ tests-done:
+ needs:
+ - trial
+ - trial-olddeps
+ - sytest
+ - portdb
+ - complement
+ runs-on: ubuntu-latest
+ steps:
+ - run: "true"
\ No newline at end of file
|