@@ -13,82 +13,108 @@ permissions:
13
13
contents : read
14
14
15
15
jobs :
16
- build :
17
- runs-on : codebuild-project-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
18
- timeout-minutes : 15
16
+ get-version :
17
+ runs-on : ubuntu-latest
19
18
outputs :
20
19
version : ${{ steps.version.outputs.version }}
21
20
steps :
22
21
- uses : actions/checkout@v4
23
-
24
- - name : Setup Node.js
25
- uses : actions/setup-node@v4
26
- with :
27
- node-version : ' 20'
28
- cache : ' npm'
29
-
30
22
- name : Get version
31
23
id : version
32
24
run : |
33
25
BASE_VERSION=$(node -p "require('./package.json').version")
34
26
echo "version=$BASE_VERSION" >> $GITHUB_OUTPUT
27
+
28
+ build :
29
+ needs : [get-version]
30
+ timeout-minutes : 30
31
+ strategy :
32
+ matrix :
33
+ include :
34
+ - arch : x86_64
35
+ runner : codebuild-project-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
36
+ - arch : aarch64
37
+ runner : codebuild-project-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
38
+ runs-on : ${{ matrix.runner }}
39
+ steps :
40
+ - uses : actions/checkout@v4
41
+
42
+ - name : Setup Node.js
43
+ uses : actions/setup-node@v4
44
+ with :
45
+ node-version : ' 20'
35
46
36
47
- name : Install build dependencies
37
48
run : |
38
49
apt-get update
39
- apt-get install -y cmake make g++
40
-
41
- - name : Clean and build
50
+ apt-get install -y cmake make g++ autotools-dev automake libtool
51
+
52
+ - name : Build natively for $(arch)
42
53
run : |
43
- rm -rf deps/*/build
44
- npm ci
54
+ echo "Building for architecture: $(arch)"
55
+ BUILD=1 npm install
45
56
npm run build
46
57
npm pack
47
58
48
59
- name : Generate checksums
49
60
run : |
50
61
PACKAGE_FILE=$(ls aws-lambda-ric-*.tgz)
51
- sha256sum $PACKAGE_FILE > checksums.sha256
52
- sha512sum $PACKAGE_FILE > checksums.sha512
53
- cat checksums.sha256 checksums.sha512 > checksums.txt
54
- echo "Package: $PACKAGE_FILE with version: ${{ steps. version.outputs.version }}" >> checksums.txt
62
+ CURRENT_ARCH=$(arch)
63
+ sha256sum $PACKAGE_FILE > checksums-$CURRENT_ARCH.sha256
64
+ sha512sum $PACKAGE_FILE > checksums-$CURRENT_ARCH.sha512
65
+ echo "Package: $PACKAGE_FILE ($CURRENT_ARCH) with version: ${{ needs.get- version.outputs.version }}" > checksums-$CURRENT_ARCH .txt
55
66
56
67
- name : Upload artifacts
57
68
uses : actions/upload-artifact@v4
58
69
with :
59
- name : package-${{ steps. version.outputs.version }}
70
+ name : package-${{ matrix.arch }}-${{ needs.get- version.outputs.version }}
60
71
path : |
61
72
aws-lambda-ric-*.tgz
62
- checksums.*
73
+ checksums-* .*
63
74
retention-days : 30
64
75
65
76
test :
66
- runs-on : ubuntu-latest
67
- needs : [build]
77
+ needs : [get-version, build]
68
78
strategy :
69
79
matrix :
70
80
node-version : [18, 20, 22]
81
+ include :
82
+ - arch : x86_64
83
+ runner : ubuntu-latest
84
+ - arch : aarch64
85
+ runner : ubuntu-latest
86
+ runs-on : ${{ matrix.runner }}
71
87
steps :
72
88
- uses : actions/checkout@v4
73
89
74
- - name : Run unit tests - Node ${{ matrix.node-version }}
90
+ - name : Run unit tests - Node ${{ matrix.node-version }} (native $(arch))
75
91
run : |
76
- docker build -f test/unit/Dockerfile.nodejs${{ matrix.node-version }}.x -t unit/nodejs.${{ matrix.node-version }}x .
92
+ docker build \
93
+ -f test/unit/Dockerfile.nodejs${{ matrix.node-version }}.x \
94
+ -t unit/nodejs.${{ matrix.node-version }}x \
95
+ .
77
96
docker run --rm unit/nodejs.${{ matrix.node-version }}x
78
97
79
98
publish :
80
99
if : startsWith(github.ref, 'refs/tags/')
81
100
runs-on : codebuild-project-awsaws-lambda-nodejs-runtime-interface-client-${{ github.run_id }}-${{ github.run_attempt }}
82
- needs : [build, test]
101
+ needs : [get-version, build, test]
83
102
permissions :
84
103
contents : write
85
104
steps :
86
105
- uses : actions/checkout@v4
87
106
88
- - name : Download artifacts
107
+ - name : Download x86_64 artifacts
108
+ uses : actions/download-artifact@v4
109
+ with :
110
+ name : package-x86_64-${{ needs.get-version.outputs.version }}
111
+ path : ./artifacts/x86_64
112
+
113
+ - name : Download aarch64 artifacts
89
114
uses : actions/download-artifact@v4
90
115
with :
91
- name : package-${{ needs.build.outputs.version }}
116
+ name : package-aarch64-${{ needs.get-version.outputs.version }}
117
+ path : ./artifacts/aarch64
92
118
93
119
- name : Setup Node.js
94
120
uses : actions/setup-node@v4
@@ -101,37 +127,37 @@ jobs:
101
127
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
102
128
chmod 0600 .npmrc
103
129
104
- - name : Determine version and package name
130
+ - name : Determine version and publish packages
105
131
id : version
106
132
run : |
107
133
if [[ "${{ github.ref }}" == refs/tags/rc-* ]]; then
108
134
RC_NUMBER=${GITHUB_REF#refs/tags/rc-}
109
- PACKAGE_VERSION="${{ needs.build .outputs.version }}-rc.${RC_NUMBER}"
135
+ PACKAGE_VERSION="${{ needs.get-version .outputs.version }}-rc.${RC_NUMBER}"
110
136
echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
111
137
echo "is_rc=true" >> $GITHUB_OUTPUT
112
- npm version $PACKAGE_VERSION --no-git- tag-version
138
+ TAG_FLAG="-- tag rc"
113
139
else
114
- echo "package_version=${{ needs.build .outputs.version }}" >> $GITHUB_OUTPUT
115
- npm version ${{ needs.build.outputs.version }} --no-git-tag-version
140
+ echo "package_version=${{ needs.get-version .outputs.version }}" >> $GITHUB_OUTPUT
141
+ TAG_FLAG=""
116
142
fi
117
- npm pack
143
+
144
+ # Publish both architecture packages
145
+ for arch in x86_64 aarch64; do
146
+ PACKAGE_FILE=$(ls ./artifacts/$arch/aws-lambda-ric-*.tgz)
147
+ npm publish $PACKAGE_FILE $TAG_FLAG --access=public
148
+ done
118
149
119
- - name : Publish to npm
150
+ - name : Combine checksums
120
151
run : |
121
- PACKAGE_FILE=$(ls aws-lambda-ric-*.tgz)
122
- if [[ "${{ steps.version.outputs.is_rc }}" == "true" ]]; then
123
- npm publish $PACKAGE_FILE --tag rc --access=public
124
- else
125
- npm publish $PACKAGE_FILE --access=public
126
- fi
152
+ cat ./artifacts/*/checksums-*.txt > combined-checksums.txt
153
+ cat ./artifacts/*/checksums-*.sha256 > combined-checksums.sha256
154
+ cat ./artifacts/*/checksums-*.sha512 > combined-checksums.sha512
127
155
128
156
- name : Create GitHub Release
129
157
if : startsWith(github.ref, 'refs/tags/')
130
158
uses : softprops/action-gh-release@v2
131
159
with :
132
160
files : |
133
- aws-lambda-ric-*.tgz
134
- checksums.sha256
135
- checksums.sha512
136
- checksums.txt
161
+ ./artifacts/*/aws-lambda-ric-*.tgz
162
+ combined-checksums.*
137
163
prerelease : ${{ steps.version.outputs.is_rc }}
0 commit comments