Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit be36d06

Browse files
committed
v2: initial commit
1 parent 6b2004a commit be36d06

File tree

118 files changed

+4617
-7363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+4617
-7363
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.editorconfig
2+
logs
3+
.venv
4+
start
5+
config.yaml
6+
registration.yaml
7+
*.db
8+
*.pickle

.editorconfig

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
# EditorConfig is awesome: https://EditorConfig.org
2-
3-
# top-most EditorConfig file
41
root = true
52

6-
# Unix-style newlines with a newline ending every file
73
[*]
4+
indent_style = tab
5+
indent_size = 4
86
end_of_line = lf
9-
insert_final_newline = true
107
charset = utf-8
11-
indent_style = space
12-
indent_size = 4
13-
14-
[*.py]
15-
max_line_length = 99
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
1610

17-
# Indentation override for all JSON/YAML files
18-
[*.{json,yaml,yml}]
11+
[*.{yaml,yml,sql}]
1912
indent_style = space
20-
indent_size = 2
13+
14+
[{.gitlab-ci.yml,.github/workflows/*.yml}]
15+
indent_size = 2

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Bug report
3+
about: If something is definitely wrong in the bridge (rather than just a setup issue),
4+
file a bug report. Remember to include relevant logs.
5+
labels: bug
6+
7+
---
8+
9+
<!--
10+
Remember to include relevant logs, the bridge version and any other details.
11+
12+
If you aren't sure what's needed, ask in the Matrix room rather than opening an
13+
incomplete issue. Issues with insufficient detail will likely just be ignored.
14+
-->

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
contact_links:
2+
- name: Troubleshooting docs & FAQ
3+
url: https://docs.mau.fi/bridges/general/troubleshooting.html
4+
about: Check this first if you're having problems setting up the bridge.
5+
- name: Support room
6+
url: https://matrix.to/#/#linkedin-matrix:nevarro.space
7+
about: For setup issues not answered by the troubleshooting docs, ask in the Matrix room.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: Enhancement request
3+
about: Submit a feature request or other suggestion
4+
labels: enhancement
5+
6+
---

.github/dependabot.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 73 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint, Build, and Deploy
1+
name: Lint & Deploy
22

33
on:
44
push:
@@ -10,64 +10,96 @@ on:
1010
- created
1111

1212
env:
13-
PYTHON_VERSION: 3.11
1413
BEEPER_BRIDGE_TYPE: linkedin
1514
CI_REGISTRY_IMAGE: "${{ secrets.CI_REGISTRY }}/bridge/linkedin"
1615
GHCR_REGISTRY: ghcr.io
1716
GHCR_REGISTRY_IMAGE: "ghcr.io/${{ github.repository }}"
17+
BINARY_NAME: linkedin-matrix
18+
1819

1920
jobs:
2021
lint:
2122
runs-on: ubuntu-latest
22-
steps:
23-
- uses: actions/checkout@v4
24-
- name: Set up Python ${{ env.PYTHON_VERSION }}
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: ${{ env.PYTHON_VERSION }}
28-
- uses: isort/isort-action@master
29-
with:
30-
sortPaths: "./linkedin_matrix"
31-
- uses: psf/black@stable
32-
with:
33-
src: "./linkedin_matrix"
34-
version: "22.3.0"
35-
- name: pre-commit
36-
run: |
37-
pip install pre-commit
38-
pre-commit run -av trailing-whitespace
39-
pre-commit run -av end-of-file-fixer
40-
pre-commit run -av check-yaml
41-
pre-commit run -av check-added-large-files
42-
43-
test:
44-
name: Run the tests
45-
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
go-version: [ "1.22", "1.23.2" ]
27+
name: Lint ${{ matrix.go-version == '1.23.2' && '(latest)' || '(old)' }}
28+
4629
steps:
4730
- uses: actions/checkout@v4
48-
- name: Set up Python ${{ env.PYTHON_VERSION }}
49-
uses: actions/setup-python@v5
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v5
5034
with:
51-
python-version: ${{ env.PYTHON_VERSION }}
35+
go-version: ${{ matrix.go-version }}
36+
cache: true
5237

53-
- name: Install dependencies
54-
run: |
55-
pip install -r requirements.txt
56-
pip install -r dev-requirements.txt
38+
- name: Install libolm
39+
run: sudo apt-get install libolm-dev libolm3
5740

58-
- name: Run pytest
41+
- name: Install dependencies
5942
run: |
60-
pytest -vv
61-
pytest -vv > pytest-coverage.txt
43+
go install golang.org/x/tools/cmd/goimports@latest
44+
go install honnef.co/go/tools/cmd/staticcheck@latest
45+
export PATH="$HOME/go/bin:$PATH"
6246
63-
- name: Comment coverage
64-
uses: coroo/[email protected]
65-
if: ${{ github.event_name == 'pull_request' && github.event.action == 'created' }}
47+
- name: Run pre-commit
48+
uses: pre-commit/[email protected]
6649

50+
build:
51+
runs-on: ubuntu-latest
52+
needs: lint
53+
env:
54+
GOPATH: ${{ github.workspace }}/.cache
55+
GOCACHE: ${{ github.workspace }}/.cache/build
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
60+
- name: Set up Go
61+
uses: actions/setup-go@v4
62+
with:
63+
go-version: "1.23.2"
64+
cache: true
65+
66+
- name: Create cache directory
67+
run: mkdir -p .cache
68+
69+
- name: Get Mautrix Version
70+
id: mautrix_version
71+
run: echo "MAUTRIX_VERSION=$(grep 'maunium.net/go/mautrix ' go.mod | awk '{ print $2 }')" >> $GITHUB_ENV
72+
73+
- name: Set LDFLAGS
74+
run: |
75+
echo "GO_LDFLAGS=-s -w -linkmode external -extldflags '-static' \
76+
-X main.Tag=${{ github.ref_name }} -X main.Commit=${{ github.sha }} \
77+
-X 'main.BuildTime=`date -Iseconds`' \
78+
-X 'maunium.net/go/mautrix.GoModVersion=${{ env.MAUTRIX_VERSION }}'" >> $GITHUB_ENV
79+
80+
- name: Build binary
81+
run: go build -ldflags "$GO_LDFLAGS" -o $BINARY_NAME ./cmd/$BINARY_NAME
82+
83+
- name: Generate SHA256 checksum
84+
run: sha256sum $BINARY_NAME | tee $BINARY_NAME.sha256sum
85+
86+
- name: Upload binary artifact
87+
uses: actions/upload-artifact@v3
88+
with:
89+
name: $BINARY_NAME
90+
path: $BINARY_NAME
6791
build-docker:
6892
runs-on: ubuntu-latest
93+
needs: build
6994
steps:
70-
- uses: actions/checkout@v4
95+
- name: Checkout code
96+
uses: actions/checkout@v4
97+
98+
- name: Download binary artifact
99+
uses: actions/download-artifact@v3
100+
with:
101+
name: $BINARY_NAME
102+
path: ./
71103

72104
- name: Set up Docker Buildx
73105
uses: docker/setup-buildx-action@v3
@@ -100,9 +132,7 @@ jobs:
100132

101133
deploy-docker:
102134
runs-on: ubuntu-latest
103-
needs:
104-
- lint
105-
- build-docker
135+
needs: build-docker
106136
if: github.ref == 'refs/heads/master'
107137
steps:
108138
- name: Login to Beeper Docker registry
@@ -138,18 +168,6 @@ jobs:
138168
BEEPER_STAGING_ADMIN_NIGHTLY_PASS: "${{ secrets.BEEPER_STAGING_ADMIN_NIGHTLY_PASS }}"
139169
BEEPER_PROD_ADMIN_NIGHTLY_PASS: "${{ secrets.BEEPER_PROD_ADMIN_NIGHTLY_PASS }}"
140170

141-
publish-pypi:
142-
runs-on: ubuntu-latest
143-
needs:
144-
- lint
145-
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
146-
steps:
147-
- uses: actions/checkout@v4
148-
- name: Publish to pypi
149-
uses: pypa/[email protected]
150-
with:
151-
password: ${{ secrets.PYPI_TOKEN }}
152-
153171
tag-docker-release:
154172
runs-on: ubuntu-latest
155173
needs:

.github/workflows/stale.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'Lock old issues'
2+
3+
on:
4+
schedule:
5+
- cron: '0 18 * * *'
6+
workflow_dispatch:
7+
8+
permissions:
9+
issues: write
10+
# pull-requests: write
11+
# discussions: write
12+
13+
concurrency:
14+
group: lock-threads
15+
16+
jobs:
17+
lock-stale:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: dessant/lock-threads@v5
21+
id: lock
22+
with:
23+
issue-inactive-days: 90
24+
process-only: issues
25+
- name: Log processed threads
26+
run: |
27+
if [ '${{ steps.lock.outputs.issues }}' ]; then
28+
echo "Issues:" && echo '${{ steps.lock.outputs.issues }}' | jq -r '.[] | "https://github.com/\(.owner)/\(.repo)/issues/\(.issue_number)"'
29+
fi

0 commit comments

Comments
 (0)