Update dependency @types/express to v5 #1225
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: Lint and Test | |
on: | |
pull_request: | |
branches-ignore: ['main'] | |
push: | |
branches-ignore: ['main'] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
# Make sure we're not running multiple release steps at the same time as this can give issues with determining the next npm version to release. | |
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case: | |
# "When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other." | |
concurrency: | |
group: credo-ts-${{ github.ref }}-${{ github.repository }}-${{ github.event_name }} | |
cancel-in-progress: true | |
jobs: | |
repo_ids: | |
runs-on: ubuntu-latest | |
outputs: | |
repo_name: ${{ steps.repo_ids.outputs.REPO_NAME }} | |
org_name: ${{ steps.repo_ids.outputs.ORG_NAME }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get repository identifiers | |
id: repo_ids | |
run: | | |
REPO_NAME=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]') | |
ORG_NAME=$(echo "${{ github.event.repository.owner.name }}" | tr '[:upper:]' '[:lower:]') | |
echo $REPO_NAME | |
echo $ORG_NAME | |
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_OUTPUT | |
echo "ORG_NAME=$ORG_NAME" >> $GITHUB_OUTPUT | |
static-checks: | |
name: Run Static Analysis Checks | |
strategy: | |
fail-fast: false | |
matrix: | |
command: [lint, depcheck, check] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
- name: Install Packages | |
run: npm install # maybe this should be changed to npm ci | |
- name: ${{ matrix.command }} | |
run: npm run ${{ matrix.command }} | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
- name: Install Packages | |
run: npm install # maybe this should be changed to npm ci | |
- name: Build the TypeScript OpenAPI with tsoa | |
run: npm run build | |
- name: Run tests | |
run: npm run test | |
check-version: | |
name: 'Check version' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check version | |
id: get_version | |
uses: digicatapult/check-version@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build-docker: | |
name: 'Build docker image' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Login to GitHub Container Registry' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Setup Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
buildkitd-flags: '--debug' | |
- name: Build image | |
uses: docker/build-push-action@v6 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: ./Dockerfile | |
# The arm64 img is added only in release ( arm ETA build-time is ~1h ) | |
platforms: linux/amd64 | |
push: false | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},mode=max | |
integration-tests: | |
name: 'Run integration tests' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Login to GitHub Container Registry' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
buildkitd-flags: '--debug' | |
- uses: actions/checkout@v4 | |
- name: Build testnet and integration images | |
uses: docker/bake-action@v5 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
files: | | |
./docker-compose-testnet.yml | |
./docker-compose-integration-tests.yml | |
set: | | |
*.cache-from=type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
*.cache-to=type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},mode=max | |
load: true | |
push: false | |
- name: Run integration tests | |
run: | | |
docker compose \ | |
-f docker-compose-testnet.yml \ | |
-f docker-compose-integration-tests.yml \ | |
up --exit-code-from integration-tests |