Yarn update #329
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: CI/CD | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
SHR_VERSION: ci | |
jobs: | |
unit-test: | |
timeout-minutes: 20 | |
permissions: | |
contents: read | |
packages: write | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Yarn | |
run: yarn install | |
- name: Build | |
run: yarn tsc | |
- name: Run Jest Tests | |
run: yarn test:unit | |
build-test-push: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Change repo info to lowercase | |
id: string | |
uses: ASzc/change-string-case-action@v5 | |
with: | |
string: ${{ github.repository }} | |
- name: Get Package Version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@main | |
- name: Check custom tag | |
run: echo ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{steps.package-version.outputs.current-version}} | |
- name: Build SHR | |
uses: docker/build-push-action@v3 | |
with: | |
tags: ghcr.io/i-tech-uw/shared-health-record:ci | |
push: false | |
load: true | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# - name: Pull containers | |
# run: docker-compose pull shr-fhir openhim-core mongo-db newman kafka zookeeper | |
# - name: Cache containers | |
# uses: satackey/[email protected] | |
# continue-on-error: true | |
# - name: Start containers | |
# run: docker-compose up -d shr-fhir mongo-db openhim-core kafka zookeeper | |
# - name: Load openhim config | |
# run: docker-compose up -d openhim-config | |
# - name: Sleep for 60 seconds | |
# run: sleep 90s | |
# shell: bash | |
# - name: Display docker logs for openhim config | |
# run: docker-compose logs openhim-config | |
# - name: Run SHR image | |
# run: docker-compose up -d shr | |
# - name: Sleep for 30 seconds | |
# run: sleep 30s | |
# shell: bash | |
# - name: Show SHR Log | |
# run: docker-compose logs shr | |
# - name: Show kafka Log | |
# run: docker-compose logs kafka | |
# - name: Check openhim-core | |
# run: curl -sSk https://localhost:8080/heartbeat | |
# - name: Show containers | |
# run: docker-compose ps | |
# - name: Show OpenHIM Log | |
# run: docker-compose logs openhim-core | |
# # Postman Testing - see https://www.postman.com/itechuw/workspace/shared-health-record/ | |
# - name: Run General Tests Collection | |
# env: | |
# POSTMAN_COLLECTION: /.postman/collections/1_general_tests.json | |
# run: docker-compose up -d newman | |
# - name: Run Laboratory Workflows Collection (collection/1525496-f28b488f-a40c-4723-8a72-a2b4f64bb5da) | |
# env: | |
# POSTMAN_COLLECTION: /.postman/collections/2_laboratory_workflows.json | |
# run: docker-compose up --exit-code-from newman newman | |
# continue-on-error: true | |
# - name: Run MLLP Tests | |
# run: docker-compose up --exit-code-from mllp_tests mllp_tests | |
# - name: Show SHR Log | |
# if: always() | |
# run: docker-compose logs shr | |
# - name: Show kafka Log | |
# if: always() | |
# run: docker-compose logs kafka | |
# - name: Stop containers | |
# if: always() | |
# run: docker-compose down | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Docker image | |
uses: docker/build-push-action@v3 | |
if: github.event_name == 'release' | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{steps.package-version.outputs.current-version}} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |