-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: Beep | ||
|
||
on: | ||
push: | ||
branches: ["beeper", "beeper-*"] | ||
pull_request: | ||
|
||
|
||
jobs: | ||
lint-style: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- run: pip install poetry | ||
- run: poetry install | ||
- run: poetry run isort --check synapse | ||
- run: poetry run black --check synapse | ||
|
||
lint-types: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- run: pip install poetry | ||
- run: poetry install --extras all | ||
- run: poetry run mypy | ||
|
||
# Tests | ||
|
||
test-trial: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- run: pip install poetry | ||
- run: poetry install --extras all | ||
- run: poetry run trial -j4 tests | ||
|
||
test-sytest: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: matrixdotorg/sytest-synapse:focal | ||
volumes: | ||
- ${{ github.workspace }}:/src | ||
env: | ||
SYTEST_BRANCH: 845764081c890180e3842f135f87e0aa778557a6 | ||
TOP: ${{ github.workspace }} | ||
POSTGRES: 1 | ||
MULTI_POSTGRES: 1 | ||
WOKRERS: 1 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run SyTest | ||
run: /bootstrap.sh synapse | ||
working-directory: /src | ||
- name: Summarise results.tap | ||
if: ${{ always() }} | ||
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap | ||
- name: Upload SyTest logs | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }}) | ||
path: | | ||
/logs/results.tap | ||
/logs/**/*.log* | ||
test-complement: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: matrix-org/complement | ||
path: complement | ||
ref: 39b3b9dbb2df96ca1df6b6ae86bdbc63fc96f39e | ||
- name: Install complement dependencies | ||
run: |- | ||
sudo apt-get -qq update | ||
sudo apt-get install -qqy libolm3 libolm-dev | ||
go install -v github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest | ||
- name: Run Complement | ||
run: ./scripts-dev/complement.sh | ||
env: | ||
COMPLEMENT_DIR: complement | ||
|
||
# Builds | ||
|
||
build-python: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-qemu-action@v2 | ||
- uses: docker/setup-buildx-action@v2 | ||
with: | ||
# TEMPORARY, see: https://github.com/docker/build-push-action/issues/761 | ||
driver-opts: | | ||
image=moby/buildkit:v0.10.6 | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.CI_REGISTRY }} | ||
username: ${{ secrets.CI_REGISTRY_USER }} | ||
password: ${{ secrets.CI_REGISTRY_PASSWORD }} | ||
- run: |- | ||
if [ "${{ github.ref_name }}" = "beeper" ]; then | ||
tag=$(cat pyproject.toml | grep -E "^version =" | sed -E 's/^version = "(.+)"$/\1/') | ||
else | ||
tag="${{ github.head_ref || github.ref_name }}" | ||
fi | ||
docker buildx build \ | ||
--push \ | ||
--platform linux/amd64 \ | ||
--tag ${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }} \ | ||
-f docker/Dockerfile \ | ||
. | ||
if [ "${{ github.ref_name }}" = "beeper" ]; then | ||
docker pull ${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }} | ||
docker tag \ | ||
${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }} \ | ||
${{ secrets.CI_REGISTRY }}/synapse:latest | ||
docker push ${{ secrets.CI_REGISTRY }}/synapse:latest | ||
fi | ||
# Ensure the image works properly | ||
docker run \ | ||
--entrypoint '' \ | ||
${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }} \ | ||
python -m synapse.app.homeserver --help | ||
echo "Pushed image: synapse:$tag-${{ github.sha }}" | ||
if [ "${{ github.ref_name }}" = "beeper" ]; then | ||
echo "Pushed image: synapse:latest" | ||
fi |