Exfiltrate workflow from internal TS #2
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
name: 'build-test' | |
on: # rebuild any PRs and main branch changes | |
pull_request: | |
push: | |
branches: | |
- main | |
- 'releases/*' | |
jobs: | |
build: # make sure build/ci work properly | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- id: npm-cache-dir | |
shell: bash | |
run: echo "dir=$(npm config get cache)" >> "${GITHUB_OUTPUT}" | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: | | |
npm ci | |
- run: | | |
npm run all | |
test-setup: # have the action save the cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: test-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Create some files in the cache | |
run: | | |
mkdir -p "$HOME/.m2/repository/com/twosigma/foo" | |
touch "$HOME/.m2/repository/com/twosigma/foo/foo.pom" | |
mkdir -p "$HOME/.m2/repository/com/twosigma/bar" | |
touch "$HOME/.m2/repository/com/twosigma/bar/bar.pom" | |
- uses: ./ | |
- name: Access the foo file to update its atime | |
run: | | |
cat "$HOME/.m2/repository/com/twosigma/foo/foo.pom" | |
test-validation: # validate the cache has the correct contents | |
runs-on: ubuntu-latest | |
needs: [test-setup] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: test-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Validate that the cache has the correct contents | |
run: | | |
# Check that foo.pom still exists | |
if [ -f "$HOME/.m2/repository/com/twosigma/foo/foo.pom" ]; then | |
echo "foo.pom exists after post step" | |
else | |
echo "foo.pom is missing after post step" | |
exit 1 | |
fi | |
# Check that bar directory does not exist after post step | |
if [ ! -d "$HOME/.m2/repository/com/twosigma/bar" ]; then | |
echo "bar directory is removed after post step" | |
else | |
echo "bar directory still exists after post step" | |
exit 1 | |
fi |