Skip to content

Commit b06a5f8

Browse files
authored
Extract CI tarball generation into separate build job (#226)
* Extract tarball generation into separate build job * Replace use of deprecated ::set-output See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
1 parent ea00939 commit b06a5f8

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed

.github/workflows/ci.yml

+38-16
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,32 @@ jobs:
2828
- run: npm run lint
2929

3030

31+
# Build a production tarball and use it to run the integration
32+
build:
33+
runs-on: ubuntu-latest
34+
35+
outputs:
36+
tarball-name: ${{ steps.pack.outputs.tarball-name }}
37+
38+
steps:
39+
- uses: actions/checkout@v3
40+
- name: Use Node.js
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: 20.x
44+
cache: "npm"
45+
- name: Build tarball
46+
id: pack
47+
run: |
48+
echo "tarball-name=$(npm --loglevel error pack)" >> $GITHUB_OUTPUT
49+
- uses: actions/upload-artifact@v3
50+
with:
51+
name: package-tarball
52+
path: ${{ steps.pack.outputs.tarball-name }}
53+
54+
3155
integration-node:
32-
needs: test
56+
needs: [test, build]
3357
runs-on: ubuntu-latest
3458

3559
env:
@@ -47,21 +71,22 @@ jobs:
4771

4872
steps:
4973
- uses: actions/checkout@v3
74+
- uses: actions/download-artifact@v3
75+
with:
76+
name: package-tarball
5077
- name: Use Node.js ${{ matrix.node-version }}
5178
uses: actions/setup-node@v3
5279
with:
5380
node-version: ${{ matrix.node-version }}
5481
cache: "npm"
55-
# Build a production tarball and run the integration tests against it.
5682
- run: |
57-
PKG_TARBALL=$(npm --loglevel error pack)
5883
npm --prefix integration/${{ matrix.suite }} install
59-
npm --prefix integration/${{ matrix.suite }} install "file:/./$PKG_TARBALL"
84+
npm --prefix integration/${{ matrix.suite }} install "./${{ needs.build.outputs.tarball-name }}"
6085
npm --prefix integration/${{ matrix.suite }} test
6186
6287
6388
integration-edge:
64-
needs: test
89+
needs: [test, build]
6590
runs-on: ubuntu-latest
6691

6792
env:
@@ -74,22 +99,23 @@ jobs:
7499

75100
steps:
76101
- uses: actions/checkout@v3
102+
- uses: actions/download-artifact@v3
103+
with:
104+
name: package-tarball
77105
- name: Use Node.js ${{ matrix.node-version }}
78106
uses: actions/setup-node@v3
79107
with:
80108
node-version: ${{ matrix.node-version }}
81109
cache: "npm"
82-
# Build a production tarball and run the integration tests against it.
83110
- run: |
84111
test "${{ matrix.suite }}" = "cloudflare-worker" && echo "REPLICATE_API_TOKEN=${{ secrets.REPLICATE_API_TOKEN }}" > integration/${{ matrix.suite }}/.dev.vars
85-
PKG_TARBALL=$(npm --loglevel error pack)
86112
npm --prefix integration/${{ matrix.suite }} install
87-
npm --prefix integration/${{ matrix.suite }} install "file:/./$PKG_TARBALL"
113+
npm --prefix integration/${{ matrix.suite }} install "./${{ needs.build.outputs.tarball-name }}"
88114
npm --prefix integration/${{ matrix.suite }} test
89115
90116
91117
integration-bun:
92-
needs: test
118+
needs: [test, build]
93119
runs-on: ubuntu-latest
94120

95121
env:
@@ -98,23 +124,19 @@ jobs:
98124
strategy:
99125
matrix:
100126
bun-version: [1.0.11]
101-
node-version: [20.x]
102127
suite: [bun]
103128

104129
steps:
105130
- uses: actions/checkout@v3
106-
- name: Use Node.js ${{ matrix.node-version }}
107-
uses: actions/setup-node@v3
131+
- uses: actions/download-artifact@v3
108132
with:
109-
node-version: ${{ matrix.node-version }}
110-
cache: "npm"
133+
name: package-tarball
111134
- name: Use Bun ${{ matrix.bun-version }}
112135
uses: oven-sh/setup-bun@v1
113136
with:
114137
bun-version: ${{ matrix.bun-version }}
115138
- run: |
116-
PKG_TARBALL=$(npm --loglevel error pack)
117139
cd integration/${{ matrix.suite }}
118140
bun uninstall replicate
119-
bun install "file:../../$PKG_TARBALL"
141+
bun install "file:../../${{ needs.build.outputs.tarball-name }}"
120142
bun test

0 commit comments

Comments
 (0)