Skip to content

Extract CI tarball generation into separate build job #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 38 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,32 @@ jobs:
- run: npm run lint


# Build a production tarball and use it to run the integration
build:
runs-on: ubuntu-latest

outputs:
tarball-name: ${{ steps.pack.outputs.tarball-name }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: "npm"
- name: Build tarball
id: pack
run: |
echo "tarball-name=$(npm --loglevel error pack)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: package-tarball
path: ${{ steps.pack.outputs.tarball-name }}


integration-node:
needs: test
needs: [test, build]
runs-on: ubuntu-latest

env:
Expand All @@ -47,21 +71,22 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: package-tarball
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
# Build a production tarball and run the integration tests against it.
- run: |
PKG_TARBALL=$(npm --loglevel error pack)
npm --prefix integration/${{ matrix.suite }} install
npm --prefix integration/${{ matrix.suite }} install "file:/./$PKG_TARBALL"
npm --prefix integration/${{ matrix.suite }} install "./${{ needs.build.outputs.tarball-name }}"
npm --prefix integration/${{ matrix.suite }} test


integration-edge:
needs: test
needs: [test, build]
runs-on: ubuntu-latest

env:
Expand All @@ -74,22 +99,23 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: package-tarball
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
# Build a production tarball and run the integration tests against it.
- run: |
test "${{ matrix.suite }}" = "cloudflare-worker" && echo "REPLICATE_API_TOKEN=${{ secrets.REPLICATE_API_TOKEN }}" > integration/${{ matrix.suite }}/.dev.vars
PKG_TARBALL=$(npm --loglevel error pack)
npm --prefix integration/${{ matrix.suite }} install
npm --prefix integration/${{ matrix.suite }} install "file:/./$PKG_TARBALL"
npm --prefix integration/${{ matrix.suite }} install "./${{ needs.build.outputs.tarball-name }}"
npm --prefix integration/${{ matrix.suite }} test


integration-bun:
needs: test
needs: [test, build]
runs-on: ubuntu-latest

env:
Expand All @@ -98,23 +124,19 @@ jobs:
strategy:
matrix:
bun-version: [1.0.11]
node-version: [20.x]
suite: [bun]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/download-artifact@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
name: package-tarball
- name: Use Bun ${{ matrix.bun-version }}
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ matrix.bun-version }}
- run: |
PKG_TARBALL=$(npm --loglevel error pack)
cd integration/${{ matrix.suite }}
bun uninstall replicate
bun install "file:../../$PKG_TARBALL"
bun install "file:../../${{ needs.build.outputs.tarball-name }}"
bun test
Loading