[PRMP-820] GoCD -> GitHub Actions #33
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
eslint: | |
name: ESLint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
- run: npm ci | |
- name: ESLint | |
run: npm run lint | |
sonarcloud: | |
name: Unit+Integration & SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Start LocalStack | |
uses: LocalStack/[email protected] | |
# https://docs.aws.amazon.com/cli/latest/reference/dynamodb/create-table.html | |
- name: Create AWS resources | |
run: |- | |
awslocal dynamodb create-table --region eu-west-2 --cli-input-json file://scripts/local-test-db-scheme.json | |
awslocal s3 mb s3://test-bucket --region eu-west-2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
- run: npm ci | |
- name: Run unit tests | |
run: npm run test:coverage | |
env: | |
S3_BUCKET_NAME: test-bucket | |
LOCALSTACK_URL: http://localhost:4566 | |
DYNAMODB_NAME: local-test-db | |
DYNAMODB_LOCAL_ENDPOINT: http://localhost:4566 | |
AWS_ACCESS_KEY_ID: 12345678901234567890 | |
AWS_SECRET_ACCESS_KEY: 12345678901234567890 | |
SERVICE_URL: http://localhost:3000 | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |