File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Go CI
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ pull_request :
8
+ branches :
9
+ - main
10
+
11
+ jobs :
12
+ build :
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Checkout code
17
+ uses : actions/checkout@v3
18
+
19
+ - name : Set up Go environment
20
+ uses : actions/setup-go@v4
21
+ with :
22
+ go-version : ' 1.20'
23
+
24
+ - name : Cache Go modules
25
+ uses : actions/cache@v3
26
+ with :
27
+ path : |
28
+ ~/.cache/go-build
29
+ ~/go/pkg/mod
30
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
31
+ restore-keys : |
32
+ ${{ runner.os }}-go-
33
+
34
+ - name : Install dependencies
35
+ run : go mod download
36
+
37
+ - name : Build application
38
+ run : go build -v .
39
+
40
+ - name : Run tests
41
+ run : go test -v ./...
42
+
43
+ - name : Docker login (if using Docker)
44
+ run : echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
45
+
46
+ - name : Build Docker image
47
+ run : docker build -t your-image-name .
48
+
49
+ - name : Push Docker image
50
+ run : docker push your-image-name
You can’t perform that action at this time.
0 commit comments