Repository navigation
137 lines (119 loc) · 3.49 KB
/
Copy pathci.yml
File metadata and controls
137 lines (119 loc) · 3.49 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on:
push:
branches: [main, master, dev]
tags: ["v*"]
pull_request:
branches: [main, master, dev]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.27.4'
cache: true
- name: Run govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@v1.9.0
govulncheck ./...
- name: Run tests
run: make test
- name: Test Trojan fallback over TLS
run: make test-integration
build:
name: Build
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.27'
cache: true
- name: Build
env:
VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || github.sha }}
run: |
if [ "${{ matrix.goarch }}" = "amd64" ]; then
make build-linux
else
make build-linux-arm64
fi
- name: Upload xboard-node artifact
uses: actions/upload-artifact@v4
with:
name: xboard-node-${{ matrix.goos }}-${{ matrix.goarch }}
path: xboard-node-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Upload xbctl artifact
uses: actions/upload-artifact@v4
with:
name: xbctl-${{ matrix.goos }}-${{ matrix.goarch }}
path: xbctl-${{ matrix.goos }}-${{ matrix.goarch }}
build-docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/pipi-happy/xnode:latest
ghcr.io/pipi-happy/xnode:${{ github.sha }}
${{ startsWith(github.ref, 'refs/tags/') && format('ghcr.io/pipi-happy/xnode:{0}', github.ref_name) || '' }}
release:
name: Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/dev'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
make_latest: ${{ startsWith(github.ref, 'refs/tags/') }}
files: |
dist/xboard-node-linux-amd64
dist/xboard-node-linux-arm64
dist/xbctl-linux-amd64
dist/xbctl-linux-arm64