Skip to content

Commit 6a3f785

Browse files
committed
Initial release
1 parent ccf95c4 commit 6a3f785

32 files changed

Lines changed: 4939 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
check:
14+
name: Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
- run: cargo check --all-targets
20+
21+
clippy:
22+
name: Clippy
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: dtolnay/rust-toolchain@stable
27+
with:
28+
components: clippy
29+
- run: cargo clippy --all-targets -- -D warnings
30+
31+
fmt:
32+
name: Format
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: dtolnay/rust-toolchain@stable
37+
with:
38+
components: rustfmt
39+
- run: cargo fmt --all -- --check
40+
41+
test:
42+
name: Test
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: dtolnay/rust-toolchain@stable
47+
- run: cargo test --all
48+
49+
build:
50+
name: Build
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: dtolnay/rust-toolchain@stable
55+
- run: cargo build --release
56+
- name: Check outputs exist
57+
run: |
58+
test -f target/release/fakenotifyd
59+
test -f target/release/libfakenotify_preload.so
60+
file target/release/fakenotifyd
61+
file target/release/libfakenotify_preload.so

.github/workflows/release.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build:
13+
name: Build ${{ matrix.target }}
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- target: x86_64-unknown-linux-gnu
19+
- target: x86_64-unknown-linux-musl
20+
- target: aarch64-unknown-linux-gnu
21+
- target: aarch64-unknown-linux-musl
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install Rust
27+
uses: dtolnay/rust-toolchain@stable
28+
with:
29+
targets: ${{ matrix.target }}
30+
31+
- name: Install cross
32+
run: cargo install cross --git https://github.com/cross-rs/cross
33+
34+
- name: Build
35+
run: cross build --release --target ${{ matrix.target }}
36+
37+
- name: Package
38+
run: |
39+
mkdir -p dist
40+
cp target/${{ matrix.target }}/release/fakenotifyd dist/fakenotifyd-${{ matrix.target }}
41+
cp target/${{ matrix.target }}/release/libfakenotify_preload.so dist/libfakenotify_preload-${{ matrix.target }}.so
42+
43+
- name: Upload artifacts
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: binaries-${{ matrix.target }}
47+
path: dist/
48+
49+
release:
50+
name: Create Release
51+
needs: build
52+
runs-on: ubuntu-latest
53+
permissions:
54+
contents: write
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Download all artifacts
60+
uses: actions/download-artifact@v4
61+
with:
62+
path: artifacts
63+
64+
- name: Prepare release files
65+
run: |
66+
mkdir -p release
67+
68+
# Copy all binaries
69+
find artifacts -type f -exec cp {} release/ \;
70+
71+
# Create convenience copies for "latest" (x86_64 musl = most portable)
72+
cp release/fakenotifyd-x86_64-unknown-linux-musl release/fakenotifyd
73+
cp release/libfakenotify_preload-x86_64-unknown-linux-musl.so release/libfakenotify_preload.so
74+
75+
ls -la release/
76+
77+
- name: Create Release
78+
uses: softprops/action-gh-release@v2
79+
with:
80+
files: release/*
81+
generate_release_notes: true
82+
83+
docker:
84+
name: Build Docker Images
85+
needs: build
86+
runs-on: ubuntu-latest
87+
permissions:
88+
contents: read
89+
packages: write
90+
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Download artifacts
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: binaries-x86_64-unknown-linux-musl
98+
path: dist
99+
100+
- name: Set up Docker Buildx
101+
uses: docker/setup-buildx-action@v3
102+
103+
- name: Login to GHCR
104+
uses: docker/login-action@v3
105+
with:
106+
registry: ghcr.io
107+
username: ${{ github.actor }}
108+
password: ${{ secrets.GITHUB_TOKEN }}
109+
110+
- name: Extract version
111+
id: version
112+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
113+
114+
- name: Build and push daemon
115+
uses: docker/build-push-action@v6
116+
with:
117+
context: .
118+
file: Dockerfile.release
119+
push: true
120+
tags: |
121+
ghcr.io/${{ github.repository_owner }}/fakenotify:${{ steps.version.outputs.version }}
122+
ghcr.io/${{ github.repository_owner }}/fakenotify:latest
123+
124+
- name: Build and push DockerMod
125+
uses: docker/build-push-action@v6
126+
with:
127+
context: ./docker-mods
128+
push: true
129+
tags: |
130+
ghcr.io/${{ github.repository_owner }}/fakenotify-mod:${{ steps.version.outputs.version }}
131+
ghcr.io/${{ github.repository_owner }}/fakenotify-mod:latest

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ target
1919
# and can be added to the global gitignore or merged into this file. For a more nuclear
2020
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
2121
#.idea/
22+
23+
24+
# Added by cargo
25+
26+
/target

0 commit comments

Comments
 (0)