-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (39 loc) · 1.1 KB
/
main.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
name: A workflow for Crawler
on: push
jobs:
build:
name: Crawler action
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Create .env file
run: |
echo "REDIS_HOST=localhost" >> .env
echo "REDIS_PORT=6379" >> .env
echo "REDIS_AUTH=" >> .env
echo "REDIS_STREAM=crawler" >> .env
echo "REDIS_DB=1" >> .env
# Add other environment variables as needed
working-directory: ${{ github.workspace }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21' # Change to the required Go version
check-latest: true
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: go build ./...
- name: Run Tests
run: go test ./...