build(deps-dev): bump axios #111
Workflow file for this run
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
# Runs tests for opened pull requests under the specific pattern. | |
name: TypeScript Pull Request Run Tests | |
on: | |
# Allow manual runs | |
workflow_dispatch: | |
# For testing, run on pushes to typescript patterns | |
push: | |
paths: | |
- "typescript-test-samples/**" | |
# Consider running on pull requests too | |
# but, that might require a more complex | |
# 'changed files' dance | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Use all supported nodejs runtimes for lambda | |
# https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html | |
node-version: [14.x,16.x,18.x] | |
name: TypeScript ${{ matrix.node-version }} Run Unit Tests | |
steps: | |
- name: Check Out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required to get diff to work or it can't find main | |
- name: Show Context | |
run: | | |
echo "HOME: $HOME" | |
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" | |
echo "GITHUB_EVENT_PATH: $GITHUB_EVENT_PATH" | |
cat $GITHUB_EVENT_PATH | |
git status | |
# Figure out which sample we're working with | |
# Do this by finding the files that differ between this | |
# branch and main (or better: PR target) | |
# Every directory under typescript is a candidate for | |
# being a sample we need to check | |
# git diff finds the files that have changed and saves to a file | |
# cat feeds that file into awk | |
# awk splits the line by '/' and saves the first segment | |
# uniq drops duplicates | |
- name: Find Changed Samples | |
run: | | |
git --no-pager diff --name-only origin/main --output $GITHUB_WORKSPACE/changed_files.txt --relative=typescript-test-samples typescript-test-samples | |
cat $GITHUB_WORKSPACE/changed_files.txt | awk -F '/' '{print($1)}' | uniq > $GITHUB_WORKSPACE/changed_patterns.txt | |
- name: Show Changed Samples | |
run: | | |
echo "Found these changed files:" | |
cat $GITHUB_WORKSPACE/changed_files.txt | |
echo "Mapped changed files to these patterns:" | |
cat $GITHUB_WORKSPACE/changed_patterns.txt | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Run Tests for Changed Samples | |
run: | | |
pwd | |
ls -l $GITHUB_WORKSPACE | |
while read changed_pattern; do | |
echo "Set to: $changed_pattern" | |
cd $GITHUB_WORKSPACE/typescript-test-samples/$changed_pattern | |
pwd | |
echo "Looking for package.json files" | |
find ./* -type f -name "package.json" | while read changed_pattern_app; | |
do | |
echo "Found package.json at: $changed_pattern_app" | |
cd $(dirname "$GITHUB_WORKSPACE/typescript-test-samples/$changed_pattern/$changed_pattern_app") | |
pwd | |
echo "Installing dependencies" | |
npm install | |
echo "Running Unit Tests" | |
npm run test:unit | |
echo "Finished with $changed_pattern_app" | |
done | |
echo "Finished with discovered package.json files" | |
done < $GITHUB_WORKSPACE/changed_patterns.txt |