Afir DPO-2883 Infran pystytys CDK:lla #189
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: Build | |
on: [push] | |
permissions: | |
contents: read | |
pages: write | |
actions: read | |
checks: write | |
id-token: write | |
jobs: | |
build: | |
if: github.repository != 'tmfg/digitraffic-common' | |
runs-on: ubuntu-20.04 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "pnpm" | |
- name: Compile | |
run: | | |
pnpm install | |
pnpm build | |
- name: Run tests | |
run: | | |
pnpm test | |
- name: Install madge | |
run: npm -g install madge | |
- name: Setup Graphviz | |
uses: ts-graphviz/setup-graphviz@v2 | |
- name: Run madge | |
id: run-madge | |
continue-on-error: true | |
run: | | |
# create image | |
madge --image dependencies.svg dist | |
# run for output | |
madge --circular dist | |
mkdir -p madge/${{ github.ref_name }} | |
mv dependencies.svg madge/${{ github.ref_name }}/dependencies.svg | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: madge/ | |
- name: Publish report | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
- name: Step summary | |
run: | | |
echo "# Summary" >> $GITHUB_STEP_SUMMARY | |
echo "[Madge report](${{ steps.deployment.outputs.page_url }}/${{ github.ref_name }}/dependencies.svg)" >> $GITHUB_STEP_SUMMARY | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: Jest test report | |
reporter: jest-junit | |
path: junit.xml | |
- name: Notify Slack | |
if: failure() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: failure | |
text: FAILED digitraffic-common build | |
fields: repo, job, took | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |