Skip to content

Commit 16feaf8

Browse files
feat: Add integration tests to GitHub Actions workflow [PLUTO-1367]
1 parent 36db748 commit 16feaf8

File tree

1 file changed

+77
-1
lines changed

1 file changed

+77
-1
lines changed

.github/workflows/go.yml

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ permissions:
44
contents: write
55

66
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
- name: Set up Go
13+
uses: actions/setup-go@v4
14+
- name: Build CLI for Linux
15+
run: |
16+
GOOS=linux GOARCH=amd64 go build -o cli-v2-linux ./cli-v2.go
17+
- name: Build CLI for Windows
18+
run: |
19+
GOOS=windows GOARCH=amd64 go build -o cli-v2.exe ./cli-v2.go
20+
- name: Build CLI for macOS
21+
run: |
22+
GOOS=darwin GOARCH=amd64 go build -o cli-v2-macos ./cli-v2.go
23+
- name: Upload CLI binaries
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: cli-binaries
27+
path: |
28+
cli-v2-linux
29+
cli-v2.exe
30+
cli-v2-macos
31+
732
test:
833
runs-on: ubuntu-latest
934
steps:
@@ -24,8 +49,59 @@ jobs:
2449
run: |
2550
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --force-coverage-parser go -r unit.coverage.out
2651
52+
ittest:
53+
needs: build
54+
runs-on: ${{ matrix.os }}
55+
strategy:
56+
matrix:
57+
os: [ubuntu-latest, windows-latest, macos-latest]
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
- name: Download CLI binaries
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: cli-binaries
65+
path: .
66+
- name: Select correct binary
67+
shell: bash
68+
run: |
69+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
70+
# Keep the .exe extension for Windows
71+
echo "Using Windows binary with .exe extension"
72+
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
73+
mv cli-v2-macos cli-v2
74+
else
75+
mv cli-v2-linux cli-v2
76+
fi
77+
- name: Make binary executable
78+
if: matrix.os != 'windows-latest'
79+
run: chmod +x cli-v2
80+
- name: Debug Windows binary
81+
if: matrix.os == 'windows-latest'
82+
run: |
83+
dir
84+
echo "Binary exists check:"
85+
if (Test-Path cli-v2.exe) { Write-Host "Binary exists" } else { Write-Host "Binary not found" }
86+
- name: Install dependencies from .codacy/codacy.yaml
87+
if: matrix.os != 'windows-latest'
88+
run: |
89+
./cli-v2 install
90+
# Disable windows it test for now.
91+
# - name: Install dependencies from .codacy/codacy.yaml (Windows)
92+
# if: matrix.os == 'windows-latest'
93+
# shell: pwsh
94+
# run: |
95+
# Get-ChildItem
96+
# Write-Host "Current directory contents:"
97+
# dir
98+
# Write-Host "Node.js version:"
99+
# node --version
100+
# Write-Host "Attempting to run CLI..."
101+
# .\cli-v2.exe install
102+
27103
release:
28-
needs: test
104+
needs: [test, ittest]
29105
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.event_name == 'push'
30106
runs-on: ubuntu-latest
31107
steps:

0 commit comments

Comments
 (0)