Skip to content

Commit 58fe6d3

Browse files
fix: adjusting the pipeline file
1 parent a9edb23 commit 58fe6d3

1 file changed

Lines changed: 36 additions & 46 deletions

File tree

.github/workflows/k6-test.yml

Lines changed: 36 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,91 +8,81 @@ on:
88

99
jobs:
1010
build:
11-
name: Build
1211
runs-on: ubuntu-latest
12+
1313
steps:
1414
- name: Checkout repository
1515
uses: actions/checkout@v4
1616

1717
- name: Setup Node.js
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: '18'
21-
22-
- name: Install project dev dependencies
23-
run: |
24-
npm ci
20+
node-version: "18"
2521

26-
- name: Upload node_modules
22+
- name: Install dependencies
23+
run: npm install
24+
- name: Upload build artifacts
2725
uses: actions/upload-artifact@v4
2826
with:
29-
name: node_modules
30-
path: node_modules
27+
name: build-artifacts
28+
path: |
29+
node_modules
30+
dist
31+
src/tests
3132
3233
test:
33-
name: Test
3434
runs-on: ubuntu-latest
3535
needs: build
36+
3637
steps:
3738
- name: Checkout repository
3839
uses: actions/checkout@v4
3940

40-
- name: Download node_modules from build
41+
- name: Download build artifacts
4142
uses: actions/download-artifact@v4
4243
with:
43-
name: node_modules
44-
path: ./
45-
46-
- name: Verify npm
47-
run: |
48-
node --version || true
49-
npm --version || true
44+
name: build-artifacts
5045

5146
- name: Install k6 v1.2.2
5247
run: |
53-
sudo apt-get update
54-
sudo apt-get install -y ca-certificates curl tar
5548
K6_VERSION=1.2.2
56-
curl -sLo k6.tar.gz "https://dl.k6.io/releases/v${K6_VERSION}/k6-v${K6_VERSION}-linux64.tar.gz"
49+
URL="https://github.com/grafana/k6/releases/download/v${K6_VERSION}/k6-v${K6_VERSION}-linux-amd64.tar.gz"
50+
51+
echo "Downloading $URL"
52+
curl -sLo k6.tar.gz "$URL"
53+
54+
echo "Extracting..."
5755
tar -xzf k6.tar.gz
58-
sudo mv "k6-v${K6_VERSION}-linux64/k6" /usr/local/bin/k6
59-
rm -rf k6.tar.gz "k6-v${K6_VERSION}-linux64"
56+
sudo mv "k6-v${K6_VERSION}-linux-amd64/k6" /usr/local/bin/k6
57+
sudo chmod +x /usr/local/bin/k6
58+
rm -rf k6.tar.gz "k6-v${K6_VERSION}-linux-amd64"
6059
61-
- name: Run k6 tests
60+
echo "k6 version:"
61+
k6 version
62+
63+
- name: Run k6 tests
6264
run: |
6365
mkdir -p results
64-
npm run test:suite -- --out json=results/output.json || true
65-
# Copy any generated HTML reports from src/tests into results/
66-
if [ -d src/tests ] && ls src/tests/*.html 1> /dev/null 2>&1; then cp src/tests/*.html results/ || true; fi
67-
# Also capture any report.html in the workspace root
68-
if [ -f report.html ]; then cp report.html results/; fi
66+
npm run test:suite -- --out json=results/output.json
67+
68+
# Relatório HTML dentro de src/tests
69+
if [ -f src/tests/report.html ]; then
70+
mv src/tests/report.html results/
71+
fi
6972
70-
- name: Upload results
73+
- name: Upload test results
7174
uses: actions/upload-artifact@v4
7275
with:
7376
name: k6-results
74-
path: results/
77+
path: results
7578

7679
deploy:
77-
name: Deploy
7880
runs-on: ubuntu-latest
7981
needs: test
80-
steps:
81-
- name: Checkout repository
82-
uses: actions/checkout@v4
8382

84-
- name: Download test results
83+
steps:
84+
- name: Download results
8585
uses: actions/download-artifact@v4
8686
with:
8787
name: k6-results
8888
path: results
89-
90-
- name: List results
91-
run: |
92-
echo "Files in results:" && ls -la results || true
93-
94-
- name: Upload final artifacts (results + report)
95-
uses: actions/upload-artifact@v4
96-
with:
97-
name: final-results
98-
path: results/

0 commit comments

Comments
 (0)