Skip to content

Commit

Permalink
proxy 0.1 (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: Maciej Wójcik <[email protected]>
  • Loading branch information
filipslezaklab and Maciej Wójcik authored Aug 7, 2023
1 parent feb5ceb commit 3089dda
Show file tree
Hide file tree
Showing 232 changed files with 17,921 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target/
web/node_modules
web/dist
.volumes/
16 changes: 16 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- Semver-Major
- breaking-change
- title: Exciting New Features 🎉
labels:
- Semver-Minor
- enhancement
- title: Other Changes
labels:
- "*"
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build latest image
on:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'LICENSE'

jobs:
publish:
runs-on: self-hosted
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/defguard/defguard-proxy
tags: |
type=raw,value=latest
type=ref,event=branch
type=sha
- name: Login to GitHub container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build container
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
30 changes: 30 additions & 0 deletions .github/workflows/lint-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint frontend

on:
push:
branches:
- main
paths:
- "web/**"
pull_request:
branches:
- main
paths:
- "web/**"

jobs:
lint-web:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
- name: install deps
working-directory: ./web
run: |
npm i -g pnpm
pnpm i --frozen-lockfile
- name: Lint
working-directory: ./web
run: pnpm lint
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Make a new release

on:
push:
tags:
- v*.*.*

jobs:
publish-docker:
runs-on: self-hosted
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/DefGuard/defguard-proxy
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable=${{ github.event_name != 'pull_request' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container
uses: docker/build-push-action@v3
with:
# platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

release:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test backend

on:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'LICENSE'
pull_request:
branches:
- main
paths-ignore:
- '*.md'
- 'LICENSE'

env:
CARGO_TERM_COLOR: always

jobs:
test:
runs-on: self-hosted
container: rust:1.71

steps:
- name: Debug
run: echo ${{ github.ref_name }}
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install protoc
run: apt-get update && apt-get -y install protobuf-compiler
- name: Check format
run: |
rustup component add rustfmt
cargo fmt -- --check
- name: Run tests
run: cargo test --locked --no-fail-fast
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
/.idea
/*.local
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "proto"]
path = proto
url = [email protected]:DefGuard/proto.git
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: clippy
Loading

0 comments on commit 3089dda

Please sign in to comment.