Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Backstage committed Jul 23, 2024
0 parents commit 721e4af
Show file tree
Hide file tree
Showing 33 changed files with 4,523 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
project:
default:
threshold: 1%
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "gitsubmodule" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
32 changes: 32 additions & 0 deletions .github/workflows/cargo-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
push:
branches:
- main
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cargo-build.yml
- rust-toolchain.toml
- "openapi/*.json"
pull_request:
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cargo-build.yml
- rust-toolchain.toml
- "openapi/*.json"
permissions: read-all
name: cargo build
jobs:
cargobuild:
name: cargo build
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run cargo build
run: |
cargo build --workspace
shell: bash
33 changes: 33 additions & 0 deletions .github/workflows/cargo-clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
branches:
- main
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cargo-clippy.yml
- "rust-toolchain.toml"
- "openapi/*.json"
pull_request:
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cargo-clippy.yml
- "rust-toolchain.toml"
- "openapi/*.json"
name: cargo clippy
jobs:
cargoclippy:
name: cargo clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: Run clippy
run: cargo clippy --workspace --tests -- -D warnings
- name: Cargo check --release
run: cargo check --release
35 changes: 35 additions & 0 deletions .github/workflows/cargo-fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
push:
branches:
- main
paths:
- "**.rs"
- "engine"
- "rust-toolchain"
- "rust-toolchain.toml"
- .github/workflows/cargo-fmt.yml
pull_request:
paths:
- "**.rs"
- "rust-toolchain"
- "rust-toolchain.toml"
- .github/workflows/cargo-fmt.yml
- "engine"
permissions:
packages: read
contents: read
name: cargo fmt
jobs:
cargofmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
rustflags: "" # use our .cargo/config.toml
- name: Run cargo fmt
run: |
cargo fmt -- --check
shell: bash
40 changes: 40 additions & 0 deletions .github/workflows/cargo-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
push:
branches:
- main
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cargo-test.yml
pull_request:
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- .github/workflows/cargo-test.yml
workflow_dispatch:
permissions: read-all
name: cargo test
jobs:
cargotest:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- name: cargo test
shell: bash
run: |
cargo llvm-cov nextest --all --lcov --output-path lcov.info --test-threads=1 --no-fail-fast
# TODO: enable codecov
# - name: Upload to codecov.io
# uses: codecov/codecov-action@v3
# with:
# token:
# fail_ci_if_error: true
# flags: unittests
# verbose: true
# files: lcov.info
43 changes: 43 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: deployment
permissions:
packages: write
contents: read
pull-requests: write
on:
push:
branches: main
paths:
- "**/*.rs"
- Cargo.toml
- Cargo.lock
- Dockerfile
- .github/workflows/docker-image.yml
- .github/workflows/deployment.yml
- kubernetes/**.yaml
workflow_dispatch:
inputs:
concurrency:
group: deploy-production
cancel-in-progress: false
jobs:
docker-image:
uses: ./.github/workflows/docker-image.yml
secrets: inherit
argocd:
needs: [docker-image]
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
# required
app-id: ${{ secrets.GH_ORG_APP_ID }}
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Dispatch deploy to infra
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ steps.app-token.outputs.token }}}
repository: kittycad/infra
event-type: kustomize-deploy
client-payload: '{"update_type": "appset", "image_name": "ghcr.io/kittycad/machine-api", "app_name": "machine-api", "sha": "${{github.sha}}"}'
77 changes: 77 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: docker-image
permissions:
packages: write
contents: read
pull-requests: write
on:
pull_request:
paths:
- "**.rs"
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- Dockerfile
- .github/workflows/docker-image.yml
schedule:
- cron: "0 0 * * *"
workflow_call:
workflow_dispatch:
inputs:
concurrency:
group: docker-image-${{ github.ref }}
cancel-in-progress: false
jobs:
docker-image:
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up env vars
shell: bash
run: |
maybe_branch=${GITHUB_HEAD_REF//\//-}
BRANCH=${maybe_branch:-main}
echo "BRANCH=${BRANCH}" >> "$GITHUB_ENV"
if [ "$BRANCH" = "main" ]; then
echo "BUILD_MODE=release" >> "$GITHUB_ENV"
else
echo "BUILD_MODE=debug" >> "$GITHUB_ENV"
fi
id: setup_env
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./Dockerfile

build-args: |
BUILD_MODE=${{ env.BUILD_MODE }}
tags: |
ghcr.io/kittycad/${{ github.event.repository.name }}:${{ env.BRANCH }}
ghcr.io/kittycad/${{ github.event.repository.name }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha
- name: Docker Scout
id: docker-scout
uses: docker/scout-action@v1
with:
image: ghcr.io/kittycad/${{ github.event.repository.name }}:${{ env.BRANCH }}
organization: zoodotdev
command: cves
ignore-base: true
ignore-unchanged: true
only-fixed: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
Loading

0 comments on commit 721e4af

Please sign in to comment.