Skip to content

Commit

Permalink
Fix CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
timokoessler committed Sep 25, 2024
1 parent b590a84 commit 4b2dcdf
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push: {}
workflow_call: {}
jobs:
build:
benchmark:
runs-on: ubuntu-latest
services:
mongodb:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push: {}
workflow_call: {}
jobs:
build:
e2etest:
runs-on: ubuntu-latest
services:
mongodb:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Lint code
on: push
jobs:
build:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/unit-test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Unit tests Windows
on:
push: {}
workflow_call: {}
jobs:
test-windows:
runs-on: windows-latest
services:
s3:
image: adobe/s3mock
env:
"initialBuckets": "bucket"
ports:
- "9090:9090"
mongodb:
image: mongo:5
env:
"MONGO_INITDB_ROOT_USERNAME": "root"
"MONGO_INITDB_ROOT_PASSWORD": "password"
ports:
- 27017:27017
postgres:
image: postgres:14-alpine
env:
"POSTGRES_PASSWORD": "password"
"POSTGRES_USER": "root"
"POSTGRES_DB": "main_db"
ports:
- "27016:5432"
mysql:
image: mysql:8.0
# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# We need to use this long command in order to execute the last part : mysql_native_password
# https://stackoverflow.com/questions/60902904/how-to-pass-mysql-native-password-to-mysql-service-in-github-actions
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=mypassword -e MYSQL_DATABASE=catsdb --entrypoint sh mysql:8.0 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
ports:
- "27015:3306"
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Add local.aikido.io to hosts file
run: |
Add-Content -Path "C:\Windows\System32\drivers\etc\hosts" -Value "127.0.0.1 local.aikido.io"
- run: npm install
- run: npm run test:ci
- name: "Upload coverage"
uses: codecov/codecov-action@v4.0.1
with:
file: ./library/.tap/report/lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
slug: AikidoSec/firewall-node
22 changes: 1 addition & 21 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Add local.aikido.io to /etc/hosts
Expand All @@ -57,23 +57,3 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
slug: AikidoSec/firewall-node
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: 20.x
- name: Add local.aikido.io to hosts file
run: |
Add-Content -Path "C:\Windows\System32\drivers\etc\hosts" -Value "127.0.0.1 local.aikido.io"
- run: npm install
- run: npm run test:ci
- name: "Upload coverage"
uses: codecov/codecov-action@v4.0.1
with:
file: ./library/.tap/report/lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
slug: AikidoSec/firewall-node
2 changes: 1 addition & 1 deletion library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
},
"scripts": {
"test": "node ../scripts/run-tap.js",
"test:ci": "CI=true node ../scripts/run-tap.js",
"test:ci": "node ../scripts/run-tap.js --ci",
"build": "tsc",
"build:watch": "tsc --watch",
"lint": "npm run lint-eslint && npm run lint-tsc",
Expand Down
5 changes: 5 additions & 0 deletions scripts/run-tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const version = process.versions.node.split(".");
const major = parseInt(version[0], 10);
const minor = parseInt(version[1], 10);

// If script is called with arg --ci, set env CI to true
if (process.argv.includes("--ci")) {
process.env.CI = "true";
}

let args = "--allow-incomplete-coverage";

if (process.env.CI) {
Expand Down

0 comments on commit 4b2dcdf

Please sign in to comment.