forked from na-Itms/trac2gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (84 loc) · 2.34 KB
/
go.yml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Go
on:
push:
branches:
- master
pull_request:
jobs:
docker:
name: Docker
runs-on: ubuntu-22.04
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Verify Docker
id: verify_docker
run: |
docker run --rm hello-world:latest > /dev/null
docker rmi hello-world:latest > /dev/null
docker version
docker compose version
- name: Cache docker images
uses: ScribeMD/[email protected]
with:
key: |
docker-${{ runner.os }}-${{ hashFiles(
'docker-compose*.yml',
'docker/**'
) }}
- name: Fix goup membership
id: fix_group
run: |
# Add the existing `runner` group to avoid the `docker` one
sudo adduser runner runner
echo "_GID=$(grep -E "^runner:" /etc/group | cut -d: -f3)" >> $GITHUB_ENV
- name: Build images
id: build_images
run: |
docker compose build --progress=plain \
--build-arg uid=$(id -u) \
--build-arg gid=${_GID}
- name: Go make
id: go_make
run: |
docker compose run go-shell sh -c "make mockdeps && make"
- name: Test binary
id: test_binary
run: |
# some basic tests on the binary built earlier
echo -n "Test for a static executable... "
ldd ./trac2gitea 2>&1 | grep -q 'not a dynamic executable' \
&& echo PASS \
|| { echo FAIL; exit 1; }
echo -n "Test for usage prompt on execution... "
./trac2gitea --help 2>&1 | grep -q '^Usage' \
&& echo 'PASS' \
|| { echo 'FAIL'; exit 1; }
nix:
name: Nix
runs-on: ubuntu-22.04
permissions:
pull-requests: write
contents: read
strategy:
matrix:
nix_path:
- nixpkgs=channel:nixos-stable
- nixpkgs=channel:nixos-unstable
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Install Nix
id: install_nix
uses: cachix/install-nix-action@v27
with:
nix_path: ${{ matrix.nix_path }}
- name: Check
id: check
run: |
nix flake check