Skip to content

Commit

Permalink
build: improve artifacts IO (#15165)
Browse files Browse the repository at this point in the history
* build: improve artifacts io

* simplify babel 8 artifact name
  • Loading branch information
JLHwung committed Nov 9, 2022
1 parent 7272f23 commit 4511a96
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 22 deletions.
50 changes: 28 additions & 22 deletions .github/workflows/ci.yml
Expand Up @@ -125,15 +125,14 @@ jobs:
- name: Ensure cwd does not contain uncommitted changes
run: |
node ./scripts/assert-dir-git-clean.js build
- name: Prepare artifacts
run: |
./scripts/get-artifact-files.sh | tar --null -cvf babel-artifact.tar --files-from=-
- uses: actions/upload-artifact@v3
with:
name: babel-artifact
path: |
codemods/*/lib/**/*
eslint/*/lib/**/*
packages/*/lib/**/*
packages/babel-standalone/*.js
!**/node_modules/**
path: babel-artifact.tar
retention-days: 5

build-windows:
name: Build Babel Artifacts On Windows
Expand Down Expand Up @@ -179,6 +178,8 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Lint
run: make -j tscheck lint-ci
- name: Ensure cwd does not contain uncommitted changes
Expand Down Expand Up @@ -223,9 +224,8 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Use Node.js ${{ matrix.node-version }} # Checkout node version for test executor
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -272,15 +272,14 @@ jobs:
BABEL_ENV: test
BABEL_8_BREAKING: true
BABEL_TYPES_8_BREAKING: true
- name: Prepare artifacts
run: |
./scripts/get-artifact-files.sh | tar --null -cvf babel-artifact.tar --files-from=-
- uses: actions/upload-artifact@v3
with:
name: babel8-test-artifact
path: |
codemods/*/lib/**/*
eslint/*/lib/**/*
packages/*/lib/**/*
packages/babel-standalone/*.js
!**/node_modules/**
name: babel8-artifact
path: babel-artifact.tar
retention-days: 5

test-babel-8-breaking:
name: Test Babel 8 breaking changes on
Expand All @@ -302,7 +301,9 @@ jobs:
yarn install
- uses: actions/download-artifact@v3
with:
name: babel8-test-artifact
name: babel8-artifact
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Generate runtime helpers
run: make build-plugin-transform-runtime-dist
- name: Test
Expand Down Expand Up @@ -334,8 +335,8 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Generate runtime helpers
run: make build-plugin-transform-runtime-dist
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Test on Windows
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
Expand All @@ -361,6 +362,8 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Download tests
run: make -j bootstrap-flow bootstrap-typescript bootstrap-test262
- name: Run Test262 Tests
Expand Down Expand Up @@ -407,9 +410,8 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Generate absoluteRuntime tests
run: yarn test:runtime:generate-absolute-runtime
- name: Test bundlers
Expand Down Expand Up @@ -495,6 +497,8 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Downgrade ESLint to 7.5.0
run: yarn up eslint@7.5.0
- name: Run babel/eslint tests
Expand Down Expand Up @@ -553,6 +557,8 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: babel-artifact
- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Checkout test runner
uses: actions/checkout@v3
with:
Expand Down
17 changes: 17 additions & 0 deletions scripts/get-artifact-files.sh
@@ -0,0 +1,17 @@
#!/bin/sh

# The artifact files will be packed into an archive shared among CI runners
# usage:
# $ get-artifact-files.sh | tar --null -cvf babel-artifact.tar --files-from=-
find . \
-type d -name "*node_modules*" -prune -false \
-o \( \
-type f -path "./codemods/*/lib/*" \
-o -type f -path "./eslint/*/lib/*" \
-o -type f -path "./packages/*/lib/*" \
-o -type f -path "./packages/babel-standalone/*" \
-o -type f -path "./packages/babel-runtime/*" -name "*.js" \
-o -type f -path "./packages/babel-runtime-corejs2/*" -name "*.js" \
-o -type f -path "./packages/babel-runtime-corejs3/*" -name "*.js" \
\) \
-print0

0 comments on commit 4511a96

Please sign in to comment.