Bump CI action #116
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
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: 91a3ab32fcb3ada91423d661125c428e6b2b7abe | |
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@v4 | |
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: 39733c1b2f8314800776748cc7164f9a34650686 | |
- 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 |