pull_request #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pull_request | |
on: [pull_request, workflow_dispatch] | |
jobs: | |
eslint: | |
name: Run eslint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run linters | |
uses: wearerequired/lint-action@v1 | |
with: | |
github_token: ${{ secrets.github_token }} | |
# Enable linters | |
eslint: true | |
prettier: true | |
eslint_extensions: ts | |
- name: OpenAPI Lint Checks | |
if: ${{ inputs.enableOpenApiCheck == true }} | |
uses: nwestfall/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ inputs.openApiFilePath }} | |
tests: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
container: node:16 | |
services: | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: bitnami/redis:6.2.7 | |
# Provide the password for postgres | |
env: | |
REDIS_ENABLE_SSL_AUTH: false | |
REDIS_DATABASE: 1 | |
ALLOW_EMPTY_PASSWORD: yes | |
ports: | |
- 6379:6379 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd "redis-cli ping || exit 1" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
zookeeper: | |
image: bitnami/zookeeper:3.8.0 | |
ports: | |
- 2181:2181 | |
env: | |
ALLOW_ANONYMOUS_LOGIN: yes | |
kafka: | |
image: bitnami/kafka:3.8.0 | |
ports: | |
- 9092:9092 | |
env: | |
KAFKA_BROKER_ID: 1 | |
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181 | |
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 | |
ALLOW_PLAINTEXT_LISTENER: yes | |
options: >- | |
--health-cmd "kafka-topics.sh --bootstrap-server localhost:9092 --list || exit 1" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
matrix: | |
node: [18.x, 20.x] | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Install Docker | |
run: | | |
apt-get update | |
apt-get install -y docker.io | |
- name: Wait for Kafka | |
run: | | |
until docker exec $(docker ps -qf "name=kafka") kafka-topics.sh --list --bootstrap-server localhost:9092; do | |
echo "Waiting for Kafka to be ready..."; | |
sleep 5; | |
done | |
- name: Create Kafka testTopic | |
run: | | |
docker exec $(docker ps -qf "name=kafka") \ | |
kafka-topics.sh --create --topic testTopic --bootstrap-server localhost:9092 | |
- name: Run tests | |
run: npm run test | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Test Reporters (Node ${{ matrix.node }}) | |
path: reports/** | |
security: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/node@master | |
continue-on-error: true | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
build_image: | |
name: Build Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v2 | |
- name: build Docker image | |
run: docker build -t test-build:latest . |