commit b98760c9cb1994ab5b919338ac44accfc0bc17be Author: Christoph J. Scherr Date: Wed Mar 20 16:04:33 2024 +0100 Initial commit diff --git a/.gitea/workflows/cargo.yaml b/.gitea/workflows/cargo.yaml new file mode 100644 index 0000000..b755c81 --- /dev/null +++ b/.gitea/workflows/cargo.yaml @@ -0,0 +1,46 @@ +name: cargo devel CI +on: + push: + branches: + - '**' + # - '!master' + +jobs: + format: + name: cargo CI + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + steps: + - name: get repo + uses: actions/checkout@v4 + - name: install rust + uses: https://github.com/dtolnay/rust-toolchain@stable + - name: install additional rust things + run: | + rustup component add rustfmt + rustup component add clippy + - name: config custom registry + run: | + mkdir -p ~/.cargo/ + echo "" > ~/.cargo/config.toml + echo "[registry]" >> ~/.cargo/config.toml + echo 'cscherr = "cscherr"' >> ~/.cargo/config.toml + echo '[registries.cscherr]' >> ~/.cargo/config.toml + echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml + cat ~/.cargo/config.toml + - name: cargo clippy check + run: cargo clippy --all-features --all-targets --workspace + - name: cargo clippy fix + run: cargo clippy --fix --all-features --all-targets --workspace + - name: cargo fmt + run: cargo fmt --all + - name: cargo test + run: cargo test --all-features --all-targets --workspace + - name: commit back to repository + uses: https://github.com/stefanzweifel/git-auto-commit-action@v5 + with: + # Optional. Commit message for the created commit. + # Defaults to "Apply automatic changes" + commit_message: automatic cargo CI changes diff --git a/.github/workflows/cargo.yaml b/.github/workflows/cargo.yaml new file mode 100644 index 0000000..29abfde --- /dev/null +++ b/.github/workflows/cargo.yaml @@ -0,0 +1,47 @@ +name: cargo devel CI +on: + push: + branches: + - '**' + # - '!master' + +jobs: + CI: + runs-on: ubuntu-latest + name: cargo CI + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + steps: + - name: get repo + uses: actions/checkout@v4 + - name: install rust + uses: dtolnay/rust-toolchain@stable + - name: install additional rust things + run: | + rustup component add rustfmt + rustup component add clippy + - name: config custom registry + run: | + mkdir -p ~/.cargo/ + echo "" > ~/.cargo/config.toml + echo "[registry]" >> ~/.cargo/config.toml + echo 'cscherr = "cscherr"' >> ~/.cargo/config.toml + echo '[registries.cscherr]' >> ~/.cargo/config.toml + echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml + cat ~/.cargo/config.toml + - name: cargo clippy check + run: cargo clippy --all-features --all-targets --workspace + - name: cargo clippy fix + run: cargo clippy --fix --all-features --all-targets --workspace + - name: cargo fmt + run: cargo fmt --all + - name: cargo test + run: cargo test --all-features --all-targets --workspace + - name: commit back to repository + uses: stefanzweifel/git-auto-commit-action@v5 + with: + # Optional. Commit message for the created commit. + # Defaults to "Apply automatic changes" + commit_message: automatic cargo CI changes diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..193d30e --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# ---> Rust +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + + + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0543e1f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "template" +version = "0.1.0" +edition = "2021" +publish = false +authors = ["Christoph J. Scherr "] +license = "MIT" +description = "No description yet" +readme = "README.md" +homepage = "https://git.cscherr.de/PlexSheep/rs-base" +repository = "https://git.cscherr.de/PlexSheep/rs-base" +keywords = ["template"] + + +[dependencies] + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b8a4560 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 PlexSheep + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a27185f --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# rs-base + +Base repository for rust projects \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 0000000..4a3d17d --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e +cargo check --all-features +echo ">>>>>>>> PUBLISHING RELEASE FOR REPO" +bash scripts/release.sh +echo ">>>>>>>> PUBLISHING TO CRATES.IO NEXT" +sleep 2 +cargo publish +echo ">>>>>>>> PUBLISHING TO CSCHERR.DE NEXT" +sleep 2 +cargo publish --registry cscherr diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..275ed55 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,24 @@ +#!/bin/bash +TOKEN=$(cat ~/.git-credentials | grep 'git.cscherr.de' | grep -P '(?:)[^:]*(?=@)' -o) +NEW_VERSION=$(cat Cargo.toml | rg '^\s*version\s*=\s*"([^"]*)"\s*$' -or '$1') +GIT_COMMIT_SHA=$(git rev-parse HEAD) +REPO=${PWD##*/} # name of cwd +BODY=" +$(git log $(git describe --tags --abbrev=0)..HEAD --pretty="- %s" --oneline --decorate) +" +USER=PlexSheep +git tag "v$NEW_VERSION" || echo "could not tag" +curl -X 'POST' \ + 'https://git.cscherr.de/api/v1/repos/PlexSheep/'$REPO'/releases' \ + -H 'accept: application/json' \ + -H "Authorization: token $TOKEN" \ + -H 'Content-Type: application/json' \ + -d '{ + "body": "'"$BODY"'", + "draft": false, + "name": "v'$NEW_VERSION'", + "prerelease": true, + "tag_name": "v'$NEW_VERSION'", + "target_commitish": "'$GIT_COMMIT_SHA'" +}' | python -m json.tool +git push || echo "could not push" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}