diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..95dbf38 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: Dark-Alex-17 diff --git a/.github/ISSUE_TEMPLATE/blank_issue.md b/.github/ISSUE_TEMPLATE/blank_issue.md new file mode 100644 index 0000000..9aef3eb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/blank_issue.md @@ -0,0 +1,4 @@ +--- +name: Blank Issue +about: Create a blank issue. +--- diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000..598f60d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,69 @@ +name: Bug Report +description: Create a report to help us improve +labels: bug +body: + - type: markdown + attributes: + value: Thank you for filing a bug report! + - type: textarea + id: problem + attributes: + label: Summary + description: > + Please provide a short summary of the bug, along with any information + you feel relevant to replicate the bug. + validations: + required: true + - type: textarea + id: reproduction-steps + attributes: + label: Reproduction Steps + value: | + I tried this: + + 1. `loki` + + I expected this to happen: + + Instead, this happened: + - type: textarea + id: loki-log + attributes: + label: Loki log + description: Include the Loki log file to help diagnose the issue. (`loki --info` to see the log_path) + value: | + | OS | Log file location | + | ------- | ----------------------------------------------------- | + | Linux | `~/.cache/loki/loki.log` | + | Mac | `~/Library/Logs/loki/loki.log` | + | Windows | `C:\Users\\AppData\Local\loki\loki.log` | + + ``` + please provide a copy of your loki log file here if possible; you may need to redact some of the lines + ``` + + - type: input + id: platform + attributes: + label: Platform + placeholder: Linux / macOS / Windows + validations: + required: true + - type: input + id: terminal-emulator + attributes: + label: Terminal Emulator + placeholder: wezterm 20220101-133340-7edc5b5a + validations: + required: true + - type: input + id: loki-version + attributes: + label: Loki Version + description: > + Loki version (`loki --version` if using a release, `git describe` if building + from main). + **Make sure that you are using the [latest loki release](https://github.com/Dark-Alex-17/loki/releases) or a newer main build** + placeholder: "loki 0.1.0" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/enhancement.md b/.github/ISSUE_TEMPLATE/enhancement.md new file mode 100644 index 0000000..b808e71 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement.md @@ -0,0 +1,13 @@ +--- +name: Enhancement +about: Suggest an improvement +title: '' +labels: enhancement +assignees: '' +--- + + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..1f06695 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,46 @@ +name: CI + +on: + pull_request: + branches: + - '*' + push: + branches: + - main + +defaults: + run: + shell: bash + +jobs: + all: + name: All + + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + + runs-on: ${{matrix.os}} + + env: + RUSTFLAGS: --deny warnings + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust Toolchain Components + uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@v2 + + - name: Test + run: cargo test --all + + - name: Clippy + run: cargo clippy --all --all-targets -- -D warnings + + - name: Format + run: cargo fmt --all --check \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a4f2230 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,146 @@ +name: Release + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+* + +jobs: + release: + name: Publish GitHub Release + permissions: + contents: write + outputs: + rc: ${{ steps.check-tag.outputs.rc }} + + strategy: + matrix: + include: + - target: aarch64-unknown-linux-musl + os: ubuntu-latest + use-cross: true + cargo-flags: "" + - target: aarch64-apple-darwin + os: macos-latest + use-cross: true + cargo-flags: "" + - target: aarch64-pc-windows-msvc + os: windows-latest + use-cross: true + cargo-flags: "" + - target: x86_64-apple-darwin + os: macos-latest + cargo-flags: "" + - target: x86_64-pc-windows-msvc + os: windows-latest + cargo-flags: "" + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + use-cross: true + cargo-flags: "" + - target: i686-unknown-linux-musl + os: ubuntu-latest + use-cross: true + cargo-flags: "" + - target: i686-pc-windows-msvc + os: windows-latest + use-cross: true + cargo-flags: "" + - target: armv7-unknown-linux-musleabihf + os: ubuntu-latest + use-cross: true + cargo-flags: "" + - target: arm-unknown-linux-musleabihf + os: ubuntu-latest + use-cross: true + cargo-flags: "" + + runs-on: ${{matrix.os}} + env: + BUILD_CMD: cargo + + steps: + - uses: actions/checkout@v4 + + - name: Check Tag + id: check-tag + shell: bash + run: | + ver=${GITHUB_REF##*/} + echo "version=$ver" >> $GITHUB_OUTPUT + if [[ "$ver" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then + echo "rc=false" >> $GITHUB_OUTPUT + else + echo "rc=true" >> $GITHUB_OUTPUT + fi + + + - name: Install Rust Toolchain Components + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Install cross + if: matrix.use-cross + uses: taiki-e/install-action@v2 + with: + tool: cross + + - name: Overwrite build command env variable + if: matrix.use-cross + shell: bash + run: echo "BUILD_CMD=cross" >> $GITHUB_ENV + + - name: Show Version Information (Rust, cargo, GCC) + shell: bash + run: | + gcc --version || true + rustup -V + rustup toolchain list + rustup default + cargo -V + rustc -V + + - name: Build + shell: bash + run: $BUILD_CMD build --locked --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }} + + - name: Build Archive + shell: bash + id: package + env: + target: ${{ matrix.target }} + version: ${{ steps.check-tag.outputs.version }} + run: | + set -euxo pipefail + + bin=${GITHUB_REPOSITORY##*/} + dist_dir=`pwd`/dist + name=$bin-$version-$target + executable=target/$target/release/$bin + + if [[ "$RUNNER_OS" == "Windows" ]]; then + executable=$executable.exe + fi + + mkdir $dist_dir + cp $executable $dist_dir + cd $dist_dir + + if [[ "$RUNNER_OS" == "Windows" ]]; then + archive=$dist_dir/$name.zip + 7z a $archive * + echo "archive=dist/$name.zip" >> $GITHUB_OUTPUT + else + archive=$dist_dir/$name.tar.gz + tar -czf $archive * + echo "archive=dist/$name.tar.gz" >> $GITHUB_OUTPUT + fi + + - name: Publish Archive + uses: softprops/action-gh-release@v2 + if: ${{ startsWith(github.ref, 'refs/tags/') }} + with: + draft: false + files: ${{ steps.package.outputs.archive }} + prerelease: ${{ steps.check-tag.outputs.rc == 'true' }} \ No newline at end of file