Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and test
on:
pull_request:
branches: [main]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
env: [ubuntu-64, macos-64, windows-64]
include:
- env: ubuntu-64
os: ubuntu-latest
toolchain: stable-x86_64-unknown-linux-gnu
- env: macos-64
os: macos-latest
toolchain: stable-x86_64-apple-darwin
- env: windows-64
os: windows-latest
toolchain: stable-x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup toolchain ${{ matrix.toolchain }} for ${{ matrix.os }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Build using ${{ matrix.toolchain }} for ${{ matrix.os }}
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
test:
name: Test
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
env: [ubuntu-64, macos-64, windows-64]
include:
- env: ubuntu-64
os: ubuntu-latest
toolchain: stable-x86_64-unknown-linux-gnu
- env: macos-64
os: macos-latest
toolchain: stable-x86_64-apple-darwin
- env: windows-64
os: windows-latest
toolchain: stable-x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain ${{ matrix.toolchain }} for ${{ matrix.os }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Test using ${{ matrix.toolchain }} for ${{ matrix.os }}
uses: actions-rs/cargo@v1
with:
command: test
args: --release --all-features
34 changes: 34 additions & 0 deletions .github/workflows/check_version_bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Check version bump
on:
pull_request:
branches: [main]
jobs:
check:
name: Check version bump
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
override: true
- name: Read branch version
id: branch_version
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
- name: Checkout main
uses: actions/checkout@v2
with:
ref: main
- name: Read main version
id: main_version
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
- name: Check version bump
run: |
if [ "${{ steps.branch_version.outputs.version }}" == "${{ steps.main_version.outputs.version }}" ]; then
echo "Missing version bump!"
exit 1
else
echo "Version was bumped!"
fi
36 changes: 36 additions & 0 deletions .github/workflows/deploy_prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy pre-release
on:
push:
branches: [staging]
jobs:
github:
name: Deploy GitHub (pre-release)
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
override: true
- name: Package
uses: actions-rs/cargo@v1
with:
command: package
args: --all-features
- name: Read crate name
id: crate_name
run: echo "crate_name=$(cargo read-manifest | jq -r .name)" >> $GITHUB_OUTPUT
- name: Read version
id: version
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
- name: Read git commit hash
id: commit_hash
run: echo "commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions
run: gh release create "${{ steps.commit_hash.outputs.commit_hash }}" --repo="$GITHUB_REPOSITORY" --target staging --title="Pre-Release ${{ steps.commit_hash.outputs.commit_hash }} (${{ steps.version.outputs.version }})" --generate-notes --prerelease "./target/package/${{ steps.crate_name.outputs.crate_name }}-${{ steps.version.outputs.version }}.crate"
54 changes: 54 additions & 0 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy release
on:
push:
branches: [main]
jobs:
crates_io:
name: Deploy crates.io (release)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
override: true
- name: Login to crates.io
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CRATES_IO_TOKEN }}
- name: Publish to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
github:
name: Deploy GitHub (release)
needs: crates_io
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
override: true
- name: Package
uses: actions-rs/cargo@v1
with:
command: package
args: --all-features
- name: Read crate name
id: crate_name
run: echo "crate_name=$(cargo read-manifest | jq -r .name)" >> $GITHUB_OUTPUT
- name: Read version
id: version
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions
run: gh release create "${{ steps.version.outputs.version }}" --repo="$GITHUB_REPOSITORY" --title="Release ${{ steps.version.outputs.version }}" --generate-notes --latest "./target/package/${{ steps.crate_name.outputs.crate_name }}-${{ steps.version.outputs.version }}.crate"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "lum"
version = "0.1.0"
edition = "2021"
description = "Lum Discord Bot"
license= "MIT"
readme = "README.md"
authors = ["Torben Schweren"]
repository = "https://github.com/Kitt3120/lum"


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
sqlx = { version = "0.7.3", features = ["runtime-tokio", "any", "postgres", "mysql", "sqlite", "tls-native-tls", "migrate", "macros", "uuid", "chrono", "json"] }
tokio = { version = "1.35.1", features = ["full"] }
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// generated by `sqlx migrate build-script`
fn main() {
// trigger recompilation when a new migration is added
println!("cargo:rerun-if-changed=migrations");
}
Empty file added migrations/0001_init.sql
Empty file.
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}