Skip to content

Merge branch 'main' into feature/dev-4401-if-a-known-user-downloads-s… #9822

Merge branch 'main' into feature/dev-4401-if-a-known-user-downloads-s…

Merge branch 'main' into feature/dev-4401-if-a-known-user-downloads-s… #9822

Workflow file for this run

name: CI
on:
push:
env:
# use the read-write access token so that build cache in nx-cloud can be updated
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- name: "Run npm install"
run: |
npm install
npx nx run-many --all --target=lint --skip-nx-cache
# npx nx run-many --all --target=test --configuration=ci
env:
TZ: Europe/Zurich
dsp-app-tests:
name: DSP-APP
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: browser-actions/setup-chrome@v1
- run: npm install
- run: npx nx run dsp-app:lint
# - run: npx nx run dsp-app:test:ci
env:
TZ: Europe/Zurich
dsp-app-e2e-tests:
name: DSP-APP E2E
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- name: Install Cypress dependencies
run: |
cd ../dsp-das/apps/dsp-app/cypress
npm install
- name: Checkout DSP-API repo
uses: actions/checkout@v3
with:
repository: dasch-swiss/dsp-api
ref: main
path: dsp-api
- name: Start API
run: |
cd dsp-api
make init-db-test
docker compose -f docker-compose.yml up -d sipi ingest api
./webapi/scripts/wait-for-api.sh
- name: Run e2e tests in CI
if: github.event_name == 'push'
run: |
cd ../dsp-das
npm run e2e-ci
- name: Run e2e tests on Cypress Cloud on push
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release-please') && github.event.pull_request.merged == true
run: |
cd ../dsp-das
export CYPRESS_RECORD_KEY=$CYPRESS_RECORD_KEY_SECRET
npm run e2e-cloud
env:
CYPRESS_RECORD_KEY_SECRET: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Upload artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-snapshots
path: apps/dsp-app/cypress/fixtures/screenshots
jdnconvertiblecalendar-tests:
name: JDNConvertibleCalendar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npx nx run jdnconvertiblecalendar:lint
- run: npx nx run jdnconvertiblecalendar:test:ci
jdnconvertiblecalendardateadapter-tests:
name: JDNConvertibleCalendarDateAdapter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npx nx run jdnconvertiblecalendardateadapter:lint
- run: npx nx run jdnconvertiblecalendardateadapter:test:ci
vre-shared-app-config-tests:
name: vre-shared-app-config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npx nx run vre-shared-app-config:lint
- run: npx nx run vre-shared-app-config:test:ci
# publish on commit to main or tag
publish:
name: Publish to Dockerhub only on main or tag (release) commits
needs: [
# test,
# dsp-app-tests,
jdnconvertiblecalendar-tests,
jdnconvertiblecalendardateadapter-tests,
vre-shared-app-config-tests
]
runs-on: ubuntu-latest
if: github.ref_name == 'main' || startsWith(github.ref, 'refs/tags')
outputs:
tag: ${{ steps.output_docker_image_tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- name: Output docker image tag
id: output_docker_image_tag
run: echo "tag=$(make docker-image-tag | tr -d '\n')" >> "$GITHUB_OUTPUT"
shell: bash # Explicit for fail-fast behaviour
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- run: make docker-publish
trigger-dev-deployment:
name: Trigger deployment to DEV
runs-on: ubuntu-latest
needs: publish
steps:
- name: Trigger deployment to DEV
env:
IMAGE_TAG: ${{ needs.publish.outputs.tag }}
JENKINS_BASIC_AUTH_USER: ${{ secrets.JENKINS_BASIC_AUTH_USER }}
JENKINS_BASIC_AUTH_PASS: ${{ secrets.JENKINS_BASIC_AUTH_PASS }}
JENKINS_DEV_WEBHOOK: ${{ secrets.JENKINS_DEV_WEBHOOK }}
run: |
curl -f -u "${JENKINS_BASIC_AUTH_USER}:${JENKINS_BASIC_AUTH_PASS}" \
-X POST "${JENKINS_DEV_WEBHOOK}" \
-d "Service=app&Version=${IMAGE_TAG}"
send-chat-notification:
name: Send google chat notification
needs: [publish]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Send notification to google chat room "DSP releases"
uses: lakto/google-chat-action@main
with:
url: ${{ secrets.GOOGLE_CHAT_DSP_RELEASES_WEBHOOK_URL }}
release-please:
name: Prepare next release
runs-on: ubuntu-latest
# Automate releases with Conventional Commit Messages as Pull Requests are merged into "main" branch
if: github.ref == 'refs/heads/main'
steps:
- name: Get release please action
uses: GoogleCloudPlatform/release-please-action@v3
with:
token: ${{ secrets.GH_TOKEN }}
release-type: node
package-name: DSP-APP
changelog-types: '[
{"type": "feat", "section": "Enhancements"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "chore", "section": "Maintenances"},
{"type": "refactor", "section": "Maintenances"},
{"type": "style", "section": "Maintenances"},
{"type": "docs", "section": "Documentation"},
{"type": "test", "section": "Tests"}
]'
# build documentation
docs-build-test:
name: Docs Build Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- run: make docs-lint
- run: make docs-build