Skip to content

Commit

Permalink
Merge branch 'main' into key_blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
awlx authored Jun 27, 2024
2 parents 1520b1b + 9483fc0 commit 646d26f
Show file tree
Hide file tree
Showing 41 changed files with 1,869 additions and 416 deletions.
2 changes: 2 additions & 0 deletions .github/buildkitd.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[worker.oci]
max-parallelism = 4
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Docs: <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates>

version: 2

updates:
- package-ecosystem: pip
directory: /
schedule: {interval: monthly}
reviewers: [freifunkMUC/salt-stack]
assignees: [freifunkMUC/salt-stack]

- package-ecosystem: github-actions
directory: /
schedule: {interval: monthly}
reviewers: [freifunkMUC/salt-stack]
assignees: [freifunkMUC/salt-stack]

- package-ecosystem: docker
directory: /
schedule: {interval: monthly}
reviewers: [freifunkMUC/salt-stack]
assignees: [freifunkMUC/salt-stack]
15 changes: 6 additions & 9 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: "/home/runner/.cache/bazel"
key: bazel
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run Bazel tests
run: bazel test ...:all --test_output=all --action_env=WGKEX_CONFIG_FILE=`pwd`/wgkex.yaml.example
- name: Python coverage
run: |
sudo apt-get install -y lcov
mkdir "${GITHUB_WORKSPACE}/src"
cd "${GITHUB_WORKSPACE}/src"
curl -L https://github.com/ulfjack/coveragepy/archive/lcov-support.tar.gz | tar xvz
curl -L https://files.pythonhosted.org/packages/18/a0/bfa6c6ab7a5f0aeb69dd169d956ead54133f5bca68a5945c4569ea2c40b3/coverage-7.1.0.tar.gz | tar xvz
cd "${GITHUB_WORKSPACE}"
bazel coverage --javabase=@bazel_tools//tools/jdk:remote_jdk11 -t- --instrument_test_targets \
bazel coverage --combined_report=lcov --javabase=@bazel_tools//tools/jdk:remote_jdk11 -t- --instrument_test_targets \
--experimental_cc_coverage --test_output=errors --linkopt=--coverage --linkopt=-lc \
--test_env=PYTHON_COVERAGE=${GITHUB_WORKSPACE}/src/coveragepy-lcov-support/__main__.py \
--test_env=PYTHON_COVERAGE=${GITHUB_WORKSPACE}/src/coverage-7.1.0/__main__.py \
--define=config_file=test ...:all
# Combine all generated reports into a single merged coverage.dat
lcov $(find ./bazel-wgkex/ -size +1 -name "*coverage.dat" | sed 's/^/\-a\ /g') -o combined.dat
lcov --extract combined.dat '*/__main__/wgkex/*' | sed 's/^SF\:.*__main__\//SF\:/g' > coverage.dat
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.dat
path-to-lcov: bazel-out/_coverage/_coverage_report.dat
4 changes: 2 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: psf/black@stable
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build Docker image

on:
push:
branches:
- main
pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
with:
config: .github/buildkitd.toml
- name: Retrieve author data
run: |
echo AUTHOR=$(curl -sSL ${{ github.event.repository.owner.url }} | jq -r '.name') >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.authors=${{ env.AUTHOR }}
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Inspect Docker image
run: docker image inspect ${{ steps.meta.outputs.tags }}
56 changes: 56 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Docker image
on:
push:
branches:
- main
tags:
- 'v*.*.*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
config: .github/buildkitd.toml
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Retrieve author data
run: |
echo AUTHOR=$(curl -sSL ${{ github.event.repository.owner.url }} | jq -r '.name') >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.authors=${{ env.AUTHOR }}
- name: Build container image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
38 changes: 0 additions & 38 deletions .github/workflows/publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: GitHub Action for pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: GitHub Action for pylint
uses: cclauss/GitHub-Action-for-pylint@master
with:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ dmypy.json
bazel-*

# docker-compose
.env
docker-compose.override.yaml
# docker-compose volumes
/volumes
Expand All @@ -141,3 +140,6 @@ docker-compose.override.yaml

# config file
wgkex.yaml

# pycharm project metadata
.idea/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### latest
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM l.gcr.io/google/bazel:latest AS builder
FROM gcr.io/bazel-public/bazel:7.1.1 AS builder

WORKDIR /wgkex

COPY . ./
COPY BUILD WORKSPACE requirements.txt ./
COPY wgkex ./wgkex

RUN ["bazel", "build", "//wgkex/broker:app"]
RUN ["bazel", "build", "//wgkex/worker:app"]
RUN ["cp", "-rL", "bazel-bin", "bazel"]

FROM python:3

FROM python:3.11.8-slim-bookworm
WORKDIR /wgkex

COPY --from=builder /wgkex/bazel /wgkex/
Expand Down
Binary file added Docs/architecture-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 646d26f

Please sign in to comment.