-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from christopherkeim/chris/setup
Initial Setup
- Loading branch information
Showing
9 changed files
with
363 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
name: Bug Report | ||
about: Create a report to help us improve | ||
title: "" | ||
labels: "" | ||
assignees: "" | ||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
|
||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
|
||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
|
||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Feature Request | ||
about: Suggest an idea for this project | ||
title: "" | ||
labels: "" | ||
assignees: "" | ||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!--- Provide a short summary of your changes in the Title above --> | ||
|
||
## Description | ||
|
||
<!--- Describe your changes in detail --> | ||
|
||
## Motivation and Context | ||
|
||
<!--- Why is this change required? What problem does it solve? --> | ||
<!--- If it fixes an open issue, please link to the issue here. --> | ||
|
||
## Testing | ||
|
||
<!--- Please describe in detail how you tested your changes. --> | ||
<!--- Include details of your testing environment, and the tests you ran to --> | ||
<!--- see how your change affects other areas of the code, etc. --> | ||
|
||
## Dependencies Added: | ||
|
||
<!--- Detail the dependencies added for this solution --> | ||
|
||
## Dependencies Removed: | ||
|
||
<!--- Detail the dependencies removed for this solution --> | ||
|
||
## Other Changes: | ||
|
||
<!--- Detail any non-related / add-on changes made to the codebase --> | ||
|
||
## Types of changes | ||
|
||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> | ||
<!--- DELETE OR COMMENT OUT THE OTHER CHOICES --> | ||
|
||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] Optimization (non-breaking change which improves performance) | ||
- [ ] Documentation (non-breaking change which improves documentation) | ||
- [ ] Refactoring / Cleanup (non-breaking change which does not add functionality or fix issues) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to change) | ||
|
||
## Checklist: | ||
|
||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> | ||
|
||
- [ ] My code follows the code style of this project. | ||
- [ ] My change requires a change to the documentation. | ||
- [ ] I have updated the documentation accordingly (or no changes needed). | ||
- [ ] I have added tests to cover my changes (or no new test are needed). | ||
- [ ] All new and existing tests are passing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# GitHub Action runners come pre-installed with Cargo 1.76.0 (latest) | ||
|
||
name: CI | ||
on: | ||
pull_request: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Format | ||
run: make format | ||
|
||
- name: Test | ||
run: make test | ||
|
||
- name: Deploy | ||
run: | | ||
echo "Deploying..." | ||
# make build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "rust_cli_template" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
clap = { version = "4.5.1", features = ["cargo", "derive"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
############################################################### | ||
# Builder | ||
############################################################### | ||
FROM rust:1.76 as build | ||
|
||
WORKDIR /app | ||
|
||
# Copy dependencies | ||
COPY . . | ||
|
||
# Build binary | ||
RUN cargo build --release | ||
|
||
|
||
############################################################### | ||
# Final | ||
############################################################### | ||
|
||
# Copy artifacts to a clean image | ||
FROM debian:stable-slim | ||
|
||
COPY --from=build /app/target/release/rust_cli_template . | ||
|
||
ENTRYPOINT [ "./rust_cli_template" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
build: | ||
cargo build --release | ||
|
||
clean: | ||
cargo clean | ||
|
||
doc: | ||
cargo doc --no-deps --open | ||
|
||
lint: | ||
cargo clippy | ||
|
||
format: | ||
cargo fmt | ||
|
||
test: | ||
cargo test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
#! /bin/bash | ||
# | ||
# This script sets up a local development environment on an Ubuntu 20.04/22.04 machine | ||
# to work with Rust (cargo 1.76.0) projects. | ||
# | ||
# Targets: | ||
# - cargo 1.76.0 | ||
# - Docker 24.0.6 | ||
# | ||
# Requirements: | ||
# - Ubuntu 20.04/22.04 | ||
# | ||
|
||
# ----------------------------------------------------------------------------------------------------------- | ||
# 0) Config: here we'll set up default variables. | ||
# ----------------------------------------------------------------------------------------------------------- | ||
|
||
# Pull the current machine's distro for GPG key targeting | ||
readonly DISTRO="$(lsb_release -d | awk -F ' ' '{print tolower($2)}')" | ||
|
||
|
||
# ----------------------------------------------------------------------------------------------------------- | ||
# 1) Base Requirements: this will ensure that you have some base requirements installed. | ||
# ----------------------------------------------------------------------------------------------------------- | ||
|
||
# Check if ca-certificates is in the apt-cache | ||
if ( apt-cache show ca-certificates > /dev/null ); then | ||
echo 'ca-certificates is already cached 🟢' | ||
else | ||
sudo apt update | ||
fi | ||
|
||
# Ensure ca-certificates package is installed on the machine | ||
if ( which update-ca-certificates > /dev/null ); then | ||
echo 'ca-certificates is already installed 🟢' | ||
else | ||
echo 'Installing ca-certificates 📜' | ||
sudo apt-get install -y ca-certificates | ||
fi | ||
|
||
# Check if curl is in the apt-cache | ||
if ( apt-cache show curl > /dev/null ); then | ||
echo 'curl is already cached 🟢' | ||
else | ||
sudo apt update | ||
fi | ||
|
||
# Ensure curl is installed on the machine | ||
if ( which curl > /dev/null ); then | ||
echo 'curl is already installed 🟢' | ||
else | ||
echo 'Installing curl 🌀' | ||
sudo apt install -y curl | ||
fi | ||
|
||
# Check if make is in the apt-cache | ||
if ( apt-cache show make > /dev/null ); then | ||
echo 'make is already cached 🟢' | ||
else | ||
sudo apt update | ||
fi | ||
|
||
# Ensure make is installed on the machine | ||
if ( which make > /dev/null ); then | ||
echo 'make is already installed 🟢' | ||
else | ||
echo 'Installing make 🔧' | ||
sudo apt install -y make | ||
fi | ||
|
||
# Check if gnupg is in the apt-cache | ||
if ( apt-cache show gpg > /dev/null ); then | ||
echo 'gnupg is already cached 🟢' | ||
else | ||
sudo apt update | ||
fi | ||
|
||
# Ensure gnupg is installed on the machine | ||
if ( which gpg > /dev/null ); then | ||
echo 'make is already installed 🟢' | ||
else | ||
echo 'Installing gnugp 🔧' | ||
sudo apt install -y gnupg | ||
fi | ||
|
||
|
||
# ----------------------------------------------------------------------------------------------------------- | ||
# 2) Rust Install: here we'll install and configure Cargo. | ||
# ----------------------------------------------------------------------------------------------------------- | ||
|
||
# Install Cargo | ||
if ( which cargo > /dev/null ); then | ||
echo "Cargo is already installed 🟢" | ||
else | ||
echo "Installing Rust 🦀" | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | ||
| sh -s -- -y | ||
source ~/.bashrc | ||
fi | ||
|
||
# Verify installation of Cargo | ||
if ( cargo version > /dev/null ); then | ||
echo "$(cargo version) 🦀 🚀" | ||
else | ||
echo "Cargo was not installed successfully 🔴" | ||
fi | ||
|
||
|
||
# ----------------------------------------------------------------------------------------------------------- | ||
# 3) Docker Install: here we'll install Docker | ||
# ----------------------------------------------------------------------------------------------------------- | ||
|
||
# ----------------------------------------------------------------------------------------------------------- | ||
# 3.1) Set up the repository: Before you install Docker Engine for the first time on a new host machine, | ||
# you need to set up the Docker repository. Afterward, you can install and update Docker from the repository. | ||
# ----------------------------------------------------------------------------------------------------------- | ||
|
||
# Add Docker’s official GPG key | ||
if [[ -f /etc/apt/keyrings/docker.gpg ]]; then | ||
echo 'Docker GPG Key already installed at /etc/apt/keyrings/docker.gpg 🟢' | ||
else | ||
echo 'Installing Docker GPG Key at /etc/apt/keyrings/docker.gpg 🔧' | ||
|
||
# Create the /etc/apt/keyrings directory with appropriate permissions | ||
sudo install -m 0755 -d /etc/apt/keyrings | ||
|
||
# Download the GPG key from Docker | ||
curl -fsSL https://download.docker.com/linux/${DISTRO}/gpg \ | ||
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
|
||
sudo chmod a+r /etc/apt/keyrings/docker.gpg | ||
fi | ||
|
||
# Set up the repository | ||
if [[ -f /etc/apt/sources.list.d/docker.list ]]; then | ||
echo 'docker.list repository already exists at /etc/apt/sources.list.d/docker.list 🟢' | ||
else | ||
echo 'Installing docker.list repository at /etc/apt/sources.list.d/docker.list 🔧' | ||
echo \ | ||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \ | ||
https://download.docker.com/linux/$DISTRO \ | ||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" \ | ||
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
fi | ||
|
||
# ----------------------------------------------------------------------------------------------------------- | ||
# 3.2) Install Docker Engine | ||
# ----------------------------------------------------------------------------------------------------------- | ||
|
||
# Check if docker-ce is in the apt-cache | ||
if ( apt-cache show docker-ce > /dev/null ); then | ||
echo 'docker-ce is already cached 🟢' | ||
else | ||
sudo apt update | ||
fi | ||
|
||
# Install Docker Engine, containerd, and Docker Compose | ||
if ( docker --version > /dev/null ); then | ||
echo 'Docker is already installed 🟢' | ||
echo "Using $(docker --version)" | ||
else | ||
echo 'Installing Docker 🐳' | ||
|
||
# Installs | ||
sudo apt-get install -y docker-ce \ | ||
docker-ce-cli \ | ||
containerd.io \ | ||
docker-buildx-plugin \ | ||
docker-compose-plugin | ||
|
||
# Verify that the Docker Engine installation is successful by running the hello-world image | ||
sudo docker run --rm hello-world | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |