Skip to content

Commit 16be954

Browse files
authored
ci: use submodules, add dependabot, automatically update (#49)
* wip * wip * remove clone * ci: update Files changed: M src/pomerium/pb/routes_pb2.py M src/pomerium/pb/routes_pb2.pyi M src/pomerium/pb/settings_pb2.py M src/pomerium/pb/settings_pb2.pyi * wip * multiple python versions * more python versions * use dependencies * checkout * remove test * set python version, only for dependabot * always run test * always run update * only commit if dependabot * update makefile * add CODEOWNERS * rename generate * wip * install * add dependabot job * update * always install --------- Co-authored-by: calebdoxsey <calebdoxsey@users.noreply.github.com>
1 parent ae4fe42 commit 16be954

16 files changed

Lines changed: 259 additions & 162 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @pomerium/dev-backend

.github/dependabot.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
version: 2
22
updates:
3+
- package-ecosystem: "gitsubmodule"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
groups:
8+
gitsubmodule:
9+
patterns:
10+
- "*"
11+
exclude-patterns:
12+
- "deps/github.com/pomerium/*"
313
- package-ecosystem: "github-actions"
414
directory: "/"
515
schedule:

.github/workflows/build.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
branches-ignore:
6+
- "dependabot/**"
7+
push:
8+
branches:
9+
- "main"
10+
11+
jobs:
12+
build:
13+
name: Build
14+
uses: ./.github/workflows/reusable-build.yaml
15+
with:
16+
ref: ${{ github.head_ref }}

.github/workflows/dependabot.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Dependabot
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "dependabot/**"
7+
8+
jobs:
9+
generate:
10+
name: Generate
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
15+
with:
16+
ref: ${{ github.head_ref }}
17+
submodules: "true"
18+
token: ${{ secrets.APPARITOR_GITHUB_TOKEN }}
19+
20+
- name: Generate
21+
run: make generate
22+
23+
- name: Commit
24+
uses: devops-infra/action-commit-push@e6a24fad602d1f92e46432c89a7e0c7fdd45d62d
25+
with:
26+
github_token: ${{ secrets.APPARITOR_GITHUB_TOKEN }}
27+
commit_message: "dependabot: generate"
28+
29+
build:
30+
name: Build
31+
needs: generate
32+
uses: ./.github/workflows/reusable-build.yaml
33+
with:
34+
ref: ${{ github.head_ref }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
19+
with:
20+
ref: ${{ inputs.ref }}
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Test
28+
run: make test

.github/workflows/test.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Update Pomerium
2+
3+
on:
4+
schedule:
5+
- cron: "40 1 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
14+
with:
15+
submodules: "true"
16+
token: ${{ secrets.APPARITOR_GITHUB_TOKEN }}
17+
18+
- name: Update Pomerium
19+
run: make update-pomerium
20+
21+
- name: Generate
22+
run: make generate
23+
24+
- name: Check for changes
25+
id: git-diff
26+
run: |
27+
git config --global user.email "apparitor@users.noreply.github.com"
28+
git config --global user.name "GitHub Actions"
29+
git add deps/github.com/pomerium
30+
git diff --cached --exit-code || echo "changed=true" >> $GITHUB_OUTPUT
31+
32+
- name: Create Pull Request
33+
if: ${{ steps.git-diff.outputs.changed }} == 'true'
34+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
35+
with:
36+
author: GitHub Actions <apparitor@users.noreply.github.com>
37+
body: "This PR updates Pomerium Dependencies"
38+
commit-message: "ci: update pomerium dependencies"
39+
delete-branch: true
40+
labels: ci
41+
title: "ci: update pomerium dependencies"
42+
token: ${{ secrets.APPARITOR_GITHUB_TOKEN }}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,3 @@ cython_debug/
146146
# End of https://www.toptal.com/developers/gitignore/api/python
147147

148148
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
149-
150-
deps/

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[submodule "deps/github.com/pomerium/enterprise-client"]
2+
path = deps/github.com/pomerium/enterprise-client
3+
url = git@github.com:pomerium/enterprise-client
4+
[submodule "deps/github.com/envoyproxy/protoc-gen-validate"]
5+
path = deps/github.com/envoyproxy/protoc-gen-validate
6+
url = git@github.com:envoyproxy/protoc-gen-validate
7+
[submodule "deps/github.com/census-instrumentation/opencensus-proto"]
8+
path = deps/github.com/census-instrumentation/opencensus-proto
9+
url = git@github.com:census-instrumentation/opencensus-proto
10+
[submodule "deps/github.com/open-telemetry/opentelemetry-proto"]
11+
path = deps/github.com/open-telemetry/opentelemetry-proto
12+
url = git@github.com:open-telemetry/opentelemetry-proto

Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
PYTHON:=python3
22

33
.PHONY: all
4-
all: test pkg
4+
all: generate test pkg
55

66
.PHONY: pkg
7-
pkg:
7+
pkg: install
88
@echo "==> $@"
9+
$(PYTHON) -m pip install build
910
$(PYTHON) -m build .
1011

11-
.PHONY: update
12-
update:
12+
.PHONY: generate
13+
generate: install
1314
@echo "==> $@"
14-
@scripts/update
15+
@scripts/generate
16+
17+
.PHONY: install
18+
install:
19+
$(PYTHON) -m pip install .
1520

1621
.PHONY: test
17-
test:
22+
test: install
1823
@echo "==> $@"
1924
PYTHONPATH=src/ $(PYTHON) -m unittest discover -s src -v
25+
26+
.PHONY: update-pomerium
27+
update-pomerium:
28+
@echo "==> $@"
29+
git submodule update --remote deps/github.com/pomerium

0 commit comments

Comments
 (0)