Skip to content

Commit

Permalink
feat: Initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
szinn committed Mar 25, 2024
1 parent 63bd0ed commit 9adaa79
Show file tree
Hide file tree
Showing 21 changed files with 1,052 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://EditorConfig.org
root = true

[*]
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4

[*.md]
indent_size = 2

[*.{yml, yaml}]
indent_size = 2
21 changes: 21 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ref: https://docs.codecov.com/docs/codecovyml-reference
coverage:
# Hold ourselves to a high bar
range: 85..100
round: down
precision: 1
status:
# ref: https://docs.codecov.com/docs/commit-status
project:
default:
# Avoid false negatives
threshold: 1%

# Test files aren't important for coverage
ignore:
- tests

# Make comments less noisy
comment:
layout: files
require_changes: true
6 changes: 6 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>szinn/renovate-config"
]
}
114 changes: 114 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
name: check

on:
push:
branches: [main]
pull_request:
# Spend CI time only on latest ref: https://github.com/jonhoo/rust-ci-conf/pull/5

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
fmt:
runs-on: ubuntu-latest
name: stable / fmt
steps:
- name: Setup Tools
shell: bash
run: |
sudo apt-get -qq update && \
sudo apt-get -qq install --no-install-recommends -y curl unzip gcc g++ git
- uses: actions/checkout@v4
with:
submodules: false
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
toolchain: [stable, beta]
steps:
- name: Setup Tools
shell: bash
run: |
sudo apt-get -qq update && \
sudo apt-get -qq install --no-install-recommends -y curl unzip gcc g++ git
- uses: actions/checkout@v4
with:
submodules: false
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: cargo clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# doc:
# name: nightly / doc
# steps:
# - name: Setup Tools
# shell: bash
# run: |
# sudo apt-get -qq update && \
# sudo apt-get -qq install --no-install-recommends -y curl unzip gcc g++ git
# - uses: actions/checkout@v4
# with:
# submodules: false
# - name: Install nightly
# uses: dtolnay/rust-toolchain@nightly
# - name: cargo doc
# run: cargo doc --no-deps --all-features
# env:
# RUSTDOCFLAGS: --cfg docsrs
hack:
runs-on: ubuntu-latest
name: ubuntu / stable / features
steps:
- name: Setup Tools
shell: bash
run: |
sudo apt-get -qq update && \
sudo apt-get -qq install --no-install-recommends -y curl unzip gcc g++ git
- uses: actions/checkout@v4
with:
submodules: false
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
- name: cargo hack
run: cargo hack --feature-powerset check
# msrv:
# runs-on: ubuntu-latest
# # we use a matrix here just because env can't be used in job names
# # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
# strategy:
# matrix:
# msrv: ["1.56.1"] # 2021 edition requires 1.56
# name: ubuntu / ${{ matrix.msrv }}
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true
# - name: Install ${{ matrix.msrv }}
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ matrix.msrv }}
# - name: cargo +${{ matrix.msrv }} check
# run: cargo check
72 changes: 72 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: "Release: s3-cdn"

on:
workflow_dispatch:
# inputs:
# version:
# description: Version to build
# default: "latest"
# required: true
# push:
# branches:
# - main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: Build s3-cdn
runs-on: ubuntu-latest
steps:
- name: Setup Tools
shell: bash
run: |
sudo apt-get -qq update && \
sudo apt-get -qq install --no-install-recommends -y curl unzip gcc g++ git
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 1

- name: Login to GHCR
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_PASSWORD }}

- name: Setup workflow Variables
id: vars
shell: bash
run: |-
VERSION="latest"
if test "$GITHUB_EVENT_NAME" == "workflow_dispatch"; then
VERSION=$(cat VERSION)
fi
echo "::set-output name=version::$VERSION"
echo "::set-output name=tag_version::s3-cdn:$VERSION"
# - name: Setup QEMU
# uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

- name: Setup Docker Buildx
id: buildx
uses: docker/[email protected]

- name: Build container image
uses: docker/build-push-action@v5
with:
build-args: |-
VERSION=${{ steps.vars.outputs.version }}
context: .
platforms: linux/amd64 # load does not support muti-arch https://github.com/docker/buildx/issues/290
file: Dockerfile
push: true
tags: |-
ghcr.io/${{ github.repository_owner }}/${{ steps.vars.outputs.tag_version }}
cache-from: type=gha
cache-to: type=gha,mode=max
66 changes: 66 additions & 0 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: Renovate

on:
workflow_dispatch:
inputs:
dryRun:
description: "Dry-Run"
default: false
required: false
type: boolean
logLevel:
description: "Log-Level"
default: "debug"
required: false
schedule:
- cron: "0 22 * * *"
push:
branches:
- main
paths:
- ".github/renovate.json5"
- ".github/renovate/**.json"
- ".github/renovate/**.json5"
- ".github/workflows/renovate.yaml"

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

env:
LOG_LEVEL: debug
DRY_RUN: false
RENOVATE_AUTODISCOVER: true
RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}"
RENOVATE_DRY_RUN: "${{ inputs.dryRun == true }}"
RENOVATE_PLATFORM: github
RENOVATE_PLATFORM_COMMIT: true

jobs:
renovate:
name: Renovate
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: tibdex/github-app-token@v2
id: app-token
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
token: "${{ steps.generate-token.outputs.token }}"

- name: Override default config from dispatch variables
run: |
echo "DRY_RUN=${{ github.event.inputs.dryRun || env.DRY_RUN }}" >> "${GITHUB_ENV}"
echo "LOG_LEVEL=${{ github.event.inputs.logLevel || env.LOG_LEVEL }}" >> "${GITHUB_ENV}"
- name: Renovate
uses: renovatebot/github-action@89bd050bafa5a15de5d9383e3129edf210422004 # v40.1.5
with:
configurationFile: .github/renovate.json5
token: "${{ steps.app-token.outputs.token }}"
62 changes: 62 additions & 0 deletions .github/workflows/scheduled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: rolling

on:
push:
branches: [main]
pull_request:
schedule:
- cron: '7 7 * * *'

# Spend CI time only on latest ref: https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
# https://twitter.com/mycoliza/status/1571295690063753218
# nightly:
# name: ubuntu / nightly
# steps:
# - name: Setup Tools
# shell: bash
# run: |
# sudo apt-get -qq update && \
# sudo apt-get -qq install --no-install-recommends -y curl unzip gcc g++ git
# - uses: actions/checkout@v4
# with:
# submodules: false
# - name: Install nightly
# uses: dtolnay/rust-toolchain@nightly
# - name: cargo generate-lockfile
# if: hashFiles('Cargo.lock') == ''
# run: cargo generate-lockfile
# - name: cargo test --locked
# run: cargo test --locked --all-features --all-targets
# https://twitter.com/alcuadrado/status/1571291687837732873
update:
runs-on: ubuntu-latest
name: ubuntu / beta / updated
# There's no point running this if no Cargo.lock was checked in in the
# first place, since we'd just redo what happened in the regular test job.
# Unfortunately, hashFiles only works in if on steps, so we reepeat it.
# if: hashFiles('Cargo.lock') != ''
steps:
- name: Setup Tools
shell: bash
run: |
sudo apt-get -qq update && \
sudo apt-get -qq install --no-install-recommends -y curl unzip gcc g++ git
- uses: actions/checkout@v4
with:
submodules: false
- name: Install beta
if: hashFiles('Cargo.lock') != ''
uses: dtolnay/rust-toolchain@beta
- name: cargo update
if: hashFiles('Cargo.lock') != ''
run: cargo update
- name: cargo test
if: hashFiles('Cargo.lock') != ''
run: cargo test --locked --all-features --all-targets
env:
RUSTFLAGS: -D deprecated
Loading

0 comments on commit 9adaa79

Please sign in to comment.