-
Notifications
You must be signed in to change notification settings - Fork 6
80 lines (79 loc) · 2.52 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
on:
push:
pull_request:
name: build
jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
name: build
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up golang
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install bats fuse3 make libcryptsetup-dev libgpgme-dev \
libcap-dev lxc libdevmapper-dev libacl1-dev libarchive-tools \
squashfuse squashfs-tools erofs-utils
- name: setup lxc
run: |
chmod ugo+x $HOME
cat /etc/subuid /etc/subgid
u=$(id -un) && g=$(id -gn)
echo "u=$u g=$g"
uidmap=$(awk -F: '$1 == u { print $2, $3 }' "u=$u" /etc/subuid)
gidmap=$(awk -F: '$1 == g { print $2, $3 }' "g=$g" /etc/subgid)
if [ "$u" = "runner" ] && [ -z "$gidmap" ]; then
# 'id -gn' shows docker, but 'runner' is in subgid
g="runner"
gidmap=$(awk -F: '$1 == g { print $2, $3 }' "g=$g" /etc/subgid)
fi
echo "uidmap=$uidmap."
echo "gidmap=$gidmap."
[ -n "$uidmap" ] && [ -n "$gidmap" ] ||
{ echo "did not get uidmap or gidmap for u=$u g=$g"; exit 1; }
mkdir -p ~/.config/lxc/
echo "writing .config/lxc/default.conf"
tee ~/.config/lxc/default.conf <<EOF
lxc.include = /etc/lxc/default.conf
lxc.idmap = u 0 $uidmap
lxc.idmap = g 0 $gidmap
EOF
set -x
cat ~/.config/lxc/default.conf
cat /etc/subuid
echo "writing /etc/lxc/lxc-usernet"
echo "$u veth lxcbr0 100" | sudo tee -a /etc/lxc/lxc-usernet
- name: lint
run: |
make gofmt
- name : unit
run: |
make gotest
- name: make
run: |
go get -v ./...
make atomfs
cp ./bin/atomfs ~/bin
cp ./bin/atomfs atomfs-${{ matrix.os }}
- name: test
run: |
make batstest
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true # optional (default = false)
files: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }} # required
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
atomfs-${{ matrix.os }}