Skip to content

Commit b9a976e

Browse files
committed
refactor: Modernize Makefile build systems, CI/CD and README conventions
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
1 parent a782ff7 commit b9a976e

File tree

13 files changed

+368
-20754
lines changed

13 files changed

+368
-20754
lines changed

.github/workflows/hydrun.yaml

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,33 @@ on:
66
schedule:
77
- cron: "0 0 * * 0"
88

9-
permissions:
10-
contents: write
11-
129
jobs:
1310
build-linux:
14-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.target.runner }}
12+
permissions:
13+
contents: read
1514
strategy:
1615
matrix:
1716
target:
17+
# Tests
1818
- id: test
1919
src: .
2020
os: golang:bookworm
21-
flags: ""
22-
cmd: ./Hydrunfile test
23-
dst: out/nonexistent*
21+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
22+
cmd: GOFLAGS="-short" ./Hydrunfile test
23+
dst: out/nonexistent
24+
runner: ubuntu-latest
25+
26+
# Integration
2427
- id: integration
2528
src: .
2629
os: golang:bookworm
27-
flags: "-e '--privileged -v /lib/modules:/lib/modules -v /dev:/dev'"
28-
cmd: ./Hydrunfile integration
29-
dst: out/nonexistent*
30+
flags: "-e '-v /tmp/ccache:/root/.cache/go-build --privileged -v /lib/modules:/lib/modules -v /dev:/dev'"
31+
cmd: GOFLAGS="-short" ./Hydrunfile integration
32+
dst: out/nonexistent
33+
runner: ubuntu-latest
34+
35+
# We don't vendor the binaries
3036

3137
steps:
3238
- name: Maximize build space
@@ -35,11 +41,17 @@ jobs:
3541
sudo rm -rf /usr/local/lib/android
3642
sudo rm -rf /opt/ghc
3743
- name: Checkout
38-
uses: actions/checkout@v2
44+
uses: actions/checkout@v4
45+
- name: Restore ccache
46+
uses: actions/cache/restore@v4
47+
with:
48+
path: |
49+
/tmp/ccache
50+
key: cache-ccache-${{ matrix.target.id }}
3951
- name: Set up QEMU
40-
uses: docker/setup-qemu-action@v1
52+
uses: docker/setup-qemu-action@v3
4153
- name: Set up Docker Buildx
42-
uses: docker/setup-buildx-action@v1
54+
uses: docker/setup-buildx-action@v3
4355
- name: Set up hydrun
4456
run: |
4557
curl -L -o /tmp/hydrun "https://github.com/pojntfx/hydrun/releases/latest/download/hydrun.linux-$(uname -m)"
@@ -49,40 +61,46 @@ jobs:
4961
run: hydrun -o ${{ matrix.target.os }} ${{ matrix.target.flags }} "${{ matrix.target.cmd }}"
5062
- name: Fix permissions for output
5163
run: sudo chown -R $USER .
64+
- name: Save ccache
65+
uses: actions/cache/save@v4
66+
with:
67+
path: |
68+
/tmp/ccache
69+
key: cache-ccache-${{ matrix.target.id }}
5270
- name: Upload output
53-
uses: actions/upload-artifact@v2
71+
uses: actions/upload-artifact@v4
5472
with:
5573
name: ${{ matrix.target.id }}
5674
path: ${{ matrix.target.dst }}
5775

5876
publish-linux:
5977
runs-on: ubuntu-latest
78+
permissions:
79+
contents: write
6080
needs: build-linux
6181

6282
steps:
6383
- name: Checkout
64-
uses: actions/checkout@v2
84+
uses: actions/checkout@v4
6585
- name: Download output
66-
uses: actions/download-artifact@v2
86+
uses: actions/download-artifact@v4
6787
with:
6888
path: /tmp/out
6989
- name: Extract branch name
7090
id: extract_branch
7191
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
7292
- name: Publish pre-release to GitHub releases
7393
if: ${{ github.ref == 'refs/heads/main' }}
74-
uses: marvinpinto/action-automatic-releases@latest
94+
uses: softprops/action-gh-release@v2
7595
with:
76-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
77-
automatic_release_tag: release-${{ steps.extract_branch.outputs.branch }}
96+
tag_name: release-${{ steps.extract_branch.outputs.branch }}
7897
prerelease: true
7998
files: |
8099
/tmp/out/*/*
81100
- name: Publish release to GitHub releases
82101
if: startsWith(github.ref, 'refs/tags/v')
83-
uses: marvinpinto/action-automatic-releases@latest
102+
uses: softprops/action-gh-release@v2
84103
with:
85-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
86104
prerelease: false
87105
files: |
88106
/tmp/out/*/*

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Public variables
2+
DESTDIR ?=
3+
PREFIX ?= /usr/local
24
OUTPUT_DIR ?= out
5+
DST ?=
36

47
# Private variables
58
obj = r3map-benchmark-direct-mount r3map-benchmark-managed-mount r3map-benchmark-migration
@@ -8,7 +11,25 @@ all: $(addprefix build/,$(obj))
811
# Build
912
build: $(addprefix build/,$(obj))
1013
$(addprefix build/,$(obj)):
14+
ifdef DST
15+
go build -o $(DST) ./cmd/$(subst build/,,$@)
16+
else
1117
go build -o $(OUTPUT_DIR)/$(subst build/,,$@) ./cmd/$(subst build/,,$@)
18+
endif
19+
20+
# Install
21+
install: $(addprefix install/,$(obj))
22+
$(addprefix install/,$(obj)):
23+
install -D -m 0755 $(OUTPUT_DIR)/$(subst install/,,$@) $(DESTDIR)$(PREFIX)/bin/$(subst install/,,$@)
24+
25+
# Uninstall
26+
uninstall: $(addprefix uninstall/,$(obj))
27+
$(addprefix uninstall/,$(obj)):
28+
rm $(DESTDIR)$(PREFIX)/bin/$(subst uninstall/,,$@)
29+
30+
# Run
31+
$(addprefix run/,$(obj)):
32+
$(subst run/,,$@) $(ARGS)
1233

1334
# Test
1435
test:
@@ -26,6 +47,10 @@ integration/direct-mount-directory:
2647
integration/managed-mount-file:
2748
$(OUTPUT_DIR)/r3map-benchmark-managed-mount --remote-backend=file
2849

50+
# Benchmark
51+
benchmark:
52+
go test -timeout 3600s -bench=./... ./...
53+
2954
# Clean
3055
clean:
3156
rm -rf out

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# r3map
1+
<img alt="Project icon" style="vertical-align: middle;" src="./docs/icon.svg" width="128" height="128" align="left">
22

3-
![Logo](./docs/logo-readme.png)
3+
# r3map
44

55
Re**m**ote **mm**ap: High-performance remote memory region mounts and migrations in user space.
66

7+
<br/>
8+
79
[![hydrun CI](https://github.com/pojntfx/r3map/actions/workflows/hydrun.yaml/badge.svg)](https://github.com/pojntfx/r3map/actions/workflows/hydrun.yaml)
810
![Go Version](https://img.shields.io/badge/go%20version-%3E=1.20-61CFDD.svg)
911
[![Go Reference](https://pkg.go.dev/badge/github.com/pojntfx/r3map.svg)](https://pkg.go.dev/github.com/pojntfx/r3map)
@@ -13,7 +15,7 @@ Re**m**ote **mm**ap: High-performance remote memory region mounts and migrations
1315

1416
r3map is a library that simplifies working with remote memory regions and migrating them between hosts.
1517

16-
It can ...
18+
It enables you to:
1719

1820
- **Create a virtual `[]byte` or a virtual file that transparently downloads remote chunks only when they are accessed**: By providing multiple frontends (such as a memory region and a file/path) for accessing or migrating a resource, integrating remote memory into existing applications is possible with little to no changes, and fully language-independent.
1921
- **`mmap` any local or remote resource instead of just files**: By exposing a simple backend interface and being fully transport-independent, r3map makes it possible to map resources such as a **S3 bucket, Cassandra or Redis database**, or even a tape drive into a memory region efficiently, as well as migrating it over an RPC framework of your choice, such as gRPC.
@@ -39,7 +41,7 @@ You can add r3map to your Go project by running the following:
3941
$ go get github.com/pojntfx/r3map/...@latest
4042
```
4143

42-
## Usage
44+
## Tutorial
4345

4446
### 1. Mapping a Remote Resource into Memory with the Direct Mount API
4547

@@ -733,6 +735,6 @@ Have any questions or need help? Chat with us [on Matrix](https://matrix.to/#/#r
733735

734736
## License
735737

736-
r3map (c) 2023 Felicitas Pojtinger and contributors
738+
r3map (c) 2024 Felicitas Pojtinger and contributors
737739

738740
SPDX-License-Identifier: Apache-2.0

docs/icon-dark.png

-172 KB
Binary file not shown.

0 commit comments

Comments
 (0)