Integration tests #12
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: Integration tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
# schedule: | |
# - cron: '0 8 * * *' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
# Integration tests are not yet ready to run in parallel | |
max-parallel: 1 | |
matrix: | |
node: | |
- 18 | |
- 20.15.1 | |
- 22.3.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- run: corepack yarn | |
- name: Download cloudflared | |
run: | | |
curl -fsSLo cloudflared-linux-amd64 https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 | |
chmod +x cloudflared-linux-amd64 | |
# can be used for debugging: | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
- run: corepack yarn vitest run --coverage | |
env: | |
TRANSLOADIT_KEY: ${{ secrets.TRANSLOADIT_KEY }} | |
TRANSLOADIT_SECRET: ${{ secrets.TRANSLOADIT_SECRET }} | |
NODE_OPTIONS: --trace-deprecation --trace-warnings | |
CLOUDFLARED_PATH: ./cloudflared-linux-amd64 | |
DEBUG: 'transloadit:*' | |
- name: Generate the badge from the json-summary | |
run: node test/generate-coverage-badge.js coverage/coverage-summary.json | |
- name: Move HTML report and badge to the correct location | |
run: | | |
mv coverage/lcov-report static-build | |
mv coverage-badge.svg static-build/ | |
# *** BEGIN PUBLISH STATIC SITE STEPS *** | |
# Use the standard checkout action to check out the destination repo to a separate directory | |
# See https://github.com/mifi/github-action-push-static | |
- uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.COVERAGE_REPO_SSH_PRIVATE_KEY }} | |
repository: transloadit/node-sdk-coverage | |
path: static-files-destination | |
# Push coverage data | |
- if: matrix.node == '22.3.0' | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email github-actions@github.com | |
# Remove existing files: | |
rm -rf static-files-destination/* | |
# Replace with new files: | |
cp -a static-build/* static-files-destination/ | |
cd static-files-destination | |
git add . | |
# git diff-index: to avoid doing the git commit failing if there are no changes to be commit | |
git diff-index --quiet HEAD || git commit --message 'Static file updates' | |
git push | |
slack-on-failure: | |
needs: [test] | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: failure | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |