Skip to content

Commit 2e579ea

Browse files
committed
Initial commit
0 parents  commit 2e579ea

140 files changed

Lines changed: 17654 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pull-request.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Pull request checks
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
fmt-clippy-test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Rust
15+
uses: actions-rs/toolchain@v1
16+
with:
17+
toolchain: stable
18+
profile: minimal
19+
override: true
20+
21+
- name: Cache cargo
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.cargo/registry
26+
~/.cargo/git
27+
target
28+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
29+
30+
- name: Install deps
31+
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
32+
33+
- name: Check formatting
34+
run: cargo fmt -- --check
35+
36+
- name: Clippy (deny warnings)
37+
run: cargo clippy --all-targets --all-features -- -D warnings
38+
39+
- name: Run tests
40+
run: cargo test --release

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Release cross-compile
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build-and-upload:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
packages: write
13+
strategy:
14+
matrix:
15+
target:
16+
- x86_64-unknown-linux-musl
17+
- i686-unknown-linux-musl
18+
- aarch64-unknown-linux-musl
19+
- armv7-unknown-linux-musleabihf
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Rust toolchain
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
toolchain: stable
29+
profile: minimal
30+
override: true
31+
32+
- name: Install target and build deps
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y \
36+
musl-tools \
37+
gcc-aarch64-linux-gnu \
38+
gcc-arm-linux-gnueabihf \
39+
gcc-i686-linux-gnu
40+
41+
rustup target add ${{ matrix.target }}
42+
43+
mkdir -p ~/.cargo
44+
45+
case "${{ matrix.target }}" in
46+
i686-unknown-linux-musl)
47+
echo '[target.i686-unknown-linux-musl]' >> ~/.cargo/config.toml
48+
echo 'linker = "i686-linux-gnu-gcc"' >> ~/.cargo/config.toml
49+
;;
50+
aarch64-unknown-linux-musl)
51+
echo '[target.aarch64-unknown-linux-musl]' >> ~/.cargo/config.toml
52+
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
53+
;;
54+
armv7-unknown-linux-musleabihf)
55+
echo '[target.armv7-unknown-linux-musleabihf]' >> ~/.cargo/config.toml
56+
echo 'linker = "arm-linux-gnueabihf-gcc"' >> ~/.cargo/config.toml
57+
;;
58+
esac
59+
60+
- name: Cache cargo registry and build
61+
uses: actions/cache@v4
62+
with:
63+
path: |
64+
~/.cargo/registry
65+
~/.cargo/git
66+
target
67+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.target }}
68+
69+
- name: Build (release)
70+
env:
71+
RUSTFLAGS: "-C target-feature=+crt-static -C link-arg=-s"
72+
run: |
73+
cargo build --release --target ${{ matrix.target }}
74+
75+
- name: Prepare artifact name
76+
id: artifact
77+
run: |
78+
BIN_NAME=auth-log-scraper
79+
VERSION=${{ github.ref_name }}
80+
TARGET=${{ matrix.target }}
81+
RELEASE_NAME="${BIN_NAME}-${VERSION}-${TARGET}"
82+
OUT="target/${TARGET}/release/${BIN_NAME}"
83+
if [ -f "${OUT}" ]; then
84+
mkdir -p "${RELEASE_NAME}"
85+
cp "${OUT}" "${RELEASE_NAME}/"
86+
cp README.md LICENSE "${RELEASE_NAME}/"
87+
cp -r man completions "${RELEASE_NAME}/"
88+
tar czf "${RELEASE_NAME}.tar.gz" "${RELEASE_NAME}"
89+
echo "found=true" >> $GITHUB_OUTPUT
90+
echo "path=${RELEASE_NAME}.tar.gz" >> $GITHUB_OUTPUT
91+
else
92+
echo "found=false" >> $GITHUB_OUTPUT
93+
fi
94+
95+
- name: Upload release asset
96+
if: steps.artifact.outputs.found == 'true'
97+
uses: softprops/action-gh-release@v1
98+
with:
99+
files: ${{ steps.artifact.outputs.path }}
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: ["main", "master"]
6+
7+
jobs:
8+
fmt-clippy-test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Rust
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
profile: minimal
20+
override: true
21+
22+
- name: Cache cargo
23+
uses: actions/cache@v4
24+
with:
25+
path: |
26+
~/.cargo/registry
27+
~/.cargo/git
28+
target
29+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
30+
31+
- name: Install deps
32+
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
33+
34+
- name: Check formatting
35+
run: cargo fmt -- --check
36+
37+
- name: Clippy (deny warnings)
38+
run: cargo clippy --all-targets --all-features -- -D warnings
39+
40+
- name: Run tests
41+
run: cargo test --release

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
/man
3+
/completions

0 commit comments

Comments
 (0)