-
Notifications
You must be signed in to change notification settings - Fork 1
/
workflow.sh
executable file
·52 lines (40 loc) · 1005 Bytes
/
workflow.sh
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
#!/bin/bash
# Set the GitHub repository name and owner
REPO_OWNER="theghostmac"
REPO_NAME="bankie.go"
# Set the workflow file path and content
WORKFLOW_FILE=".github/workflows/build.yml"
WORKFLOW_CONTENT="
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Go environment
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Build
run: go build ./cmd/app
- name: Run tests
run: go test -v ./...
- name: Create coverage report
run: go test -coverprofile=coverage.out ./...
- name: Upload coverage report
uses: codecov/codecov-action@v2
with:
file: coverage.out
flags: unittests
"
# Create the workflow file
echo "$WORKFLOW_CONTENT" > "$WORKFLOW_FILE"
say "GitHub workflow created successfully!"