Skip to content

Commit c1b6107

Browse files
committed
Setup GitHub Actions
1 parent b7bb2bb commit c1b6107

File tree

6 files changed

+42
-81
lines changed

6 files changed

+42
-81
lines changed

.circleci/config.yml

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,6 @@ executors:
2727
resource_class: windows.medium
2828

2929
workflows:
30-
main-wf:
31-
jobs:
32-
- test
33-
- gor/release:
34-
version: "2.1.0"
35-
go-version: "1.22.6"
36-
dry-run: true
37-
post-steps:
38-
- persist_to_workspace:
39-
root: "."
40-
paths:
41-
- "dist"
42-
- test-with-images:
43-
requires:
44-
- gor/release
45-
matrix:
46-
parameters:
47-
image:
48-
- linux-docker
49-
- linux-amd64
50-
- linux-arm64
51-
- macos
52-
#- windows
5330
release-wf:
5431
jobs:
5532
- test:
@@ -86,59 +63,6 @@ workflows:
8663
context: k8s-ctx
8764

8865
jobs:
89-
test:
90-
docker:
91-
- image: cimg/go:1.22.6
92-
environment:
93-
GOTESTSUM_JUNITFILE: "junit/unit-tests.xml"
94-
steps:
95-
- checkout
96-
- restore_cache:
97-
keys:
98-
- go-mod-v1-{{ checksum "go.sum" }}
99-
- run:
100-
name: "Download Dependancies"
101-
command: cd arc && go mod download
102-
- run:
103-
name: "Run Tests & Coverage"
104-
command: |
105-
cd ./arc
106-
mkdir junit
107-
gotestsum -- -coverprofile=coverage.txt -covermode=atomic ./...
108-
bash <(curl -s https://codecov.io/bash)
109-
- store_test_results:
110-
path: junit
111-
- store_artifacts:
112-
path: junit/unit-tests.xml
113-
- run:
114-
name: "Upload to Codecov"
115-
command: cd arc && bash <(curl -s https://codecov.io/bash)
116-
- save_cache:
117-
key: go-mod-v1-{{ checksum "go.sum" }}
118-
paths:
119-
- "/home/circleci/.cache/go-build"
120-
test-with-images:
121-
parameters:
122-
image:
123-
type: executor
124-
executor: <<parameters.image>>
125-
steps:
126-
- osd/init
127-
- attach_workspace:
128-
at: .
129-
- run: |
130-
V1=""
131-
132-
if uname -m | grep "x86_64"; then
133-
V1="_v1"
134-
fi
135-
136-
if [ $OSD_FAMILY == "linux" ]; then
137-
138-
./dist/arc_linux_$(dpkg --print-architecture)${V1}/arc version
139-
else
140-
./dist/arc_darwin_arm64/arc version
141-
fi
14266
deb-publish:
14367
executor: linux-amd64
14468
steps:

.github/workflows/main.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Main WF"
2+
3+
on: push
4+
5+
jobs:
6+
unit-tests:
7+
runs-on: ubuntu-22.04
8+
env:
9+
TEST_RESULTS: /tmp/test-results
10+
GOTESTSUM_JUNITFILE: "junit/unit-tests.xml"
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-go@v5
14+
with:
15+
go-version-file: './go.mod'
16+
- name: "Install Deps"
17+
run: |
18+
curl -sSL "https://github.com/magefile/mage/releases/download/v1.15.0/mage_1.15.0_Linux-64bit.tar.gz" | sudo tar -xz --no-same-owner -C /usr/local/bin mage
19+
mage --version
20+
go install github.com/jackc/tern/v2@latest
21+
tern version
22+
go install gotest.tools/gotestsum@latest
23+
gotestsum --version
24+
- run: cd arc && mage -v test
25+
build-dry-run:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: goreleaser/goreleaser-action@v6
30+
with:
31+
version: '2.2.0'
32+
args: "release --snapshot"

.goreleaser.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ archives:
3030
name_template: >-
3131
{{ .ProjectName }}-v{{ .Version }}-{{ if eq .Os "darwin" }}macos{{ else }}{{ .Os }}{{ end }}-{{ .Arch }}{{ if .Arm }}hf{{ end }}
3232
files:
33-
- LICENSE
34-
- README.md
35-
- completions/*
33+
- ./LICENSE
34+
- ./README.md
35+
- ./completions/*
3636

3737
nfpms:
3838
- package_name: hubci-arc

arc/cmd/clone_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ func TestClonePass(t *testing.T) {
4141
rootCmd.Execute()
4242

4343
// check to see if repo was cloned
44-
if _, err := os.Stat("/home/circleci/Repos/hubci/arc/.git"); os.IsNotExist(err) {
44+
homeDir, err := os.UserHomeDir()
45+
if err != nil {
46+
t.Error("Failed to read user's home directory.")
47+
}
48+
49+
if _, err := os.Stat(homeDir + "/Repos/hubci/arc/.git"); os.IsNotExist(err) {
4550
t.Error("`arc clone` failed to clone the arc repository.")
4651
}
4752
}
File renamed without changes.

scripts/completions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ rm -rf ./completions
66
mkdir ./completions
77

88
for sh in bash fish zsh; do
9-
go run ./arc/main.go completion "$sh" >"completions/arc.$sh"
9+
go run ./arc/. completion "$sh" >"completions/arc.$sh"
1010
done

0 commit comments

Comments
 (0)