27
27
outputs :
28
28
docsChange : ${{ steps.docs-change.outputs.DOCS_CHANGE }}
29
29
isRelease : ${{ steps.check-release.outputs.IS_RELEASE }}
30
+ weekNum : ${{ steps.get-week.outputs.WEEK }}
30
31
steps :
31
32
- name : Setup node
32
33
uses : actions/setup-node@v2
59
60
else
60
61
echo "::set-output name=IS_RELEASE::false"
61
62
fi
63
+ # We use week in the turbo cache key to keep the cache from infinitely growing
64
+ - id : get-week
65
+ run : echo ::set-output name=WEEK::$(date +%U)
62
66
63
67
- uses : actions/cache@v2
64
68
id : cache-build
@@ -655,13 +659,20 @@ jobs:
655
659
path : ~/.cargo/git
656
660
key : stable-ubuntu-18.04-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
657
661
658
- - name : Cache native binary
659
- id : binary-cache
660
- uses : actions/cache@v2
661
- if : ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
662
- with :
663
- path : packages/next-swc/native/next-swc.linux-x64-gnu.node
664
- key : dev-next-swc-nightly-2021-11-15-linux-x64-gnu-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
662
+ # We use week in the turbo cache key to keep the cache from infinitely growing
663
+ - id : get-week
664
+ run : echo ::set-output name=WEEK::$(date +%U)
665
+
666
+ # - name: Turbo Cache
667
+ # id: turbo-cache
668
+ # uses: actions/cache@v2
669
+ # if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
670
+ # with:
671
+ # path: .turbo
672
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
673
+ # restore-keys: |
674
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-
675
+ # turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}-
665
676
666
677
# We use restore-key to pick latest cache.
667
678
# We will not get exact match, but doc says
@@ -678,13 +689,17 @@ jobs:
678
689
# since the repo's dependencies aren't installed we need
679
690
# to install napi globally
680
691
-
run :
npm i -g @napi-rs/[email protected]
692
+
681
693
682
694
- name : Build
683
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
695
+ if : ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
696
+ working-directory : packages/next-swc
684
697
run : yarn build-native
685
698
env :
686
699
MACOSX_DEPLOYMENT_TARGET : ' 10.13'
687
- working-directory : packages/next-swc
700
+ TURBO_TOKEN : ${{ secrets.TURBO_TOKEN }}
701
+ TURBO_TEAM : nextjs
702
+ TURBO_PROJECT : nextjs
688
703
689
704
- name : Upload artifact
690
705
@@ -833,12 +848,15 @@ jobs:
833
848
path : ~/.cargo/git
834
849
key : stable-${{ matrix.os }}-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
835
850
836
- - name : Cache native binary
837
- id : binary-cache
838
- uses : actions/cache@v2
839
- with :
840
- path : packages/next-swc/native/next-swc.${{ matrix.name }}.node
841
- key : next-swc-nightly-2021-11-15-${{ matrix.target }}-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
851
+ # - name: Turbo cache
852
+ # id: turbo-cache
853
+ # uses: actions/cache@v2
854
+ # with:
855
+ # path: .turbo
856
+ # key: turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
857
+ # restore-keys: |
858
+ # turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
859
+ # turbo-${{ github.job }}-${{ matrix.name }}-canary-${{ needs.build.outputs.weekNum }}-
842
860
843
861
- name : Cross build aarch64 setup
844
862
if : ${{ matrix.target == 'aarch64-apple-darwin' }}
@@ -861,11 +879,13 @@ jobs:
861
879
next-swc-cargo-cache-${{ matrix.os }}
862
880
863
881
- name : ' Build'
864
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
882
+ working-directory : packages/next-swc
865
883
run : yarn build-native --release --target ${{ matrix.target }}
866
884
env :
867
885
MACOSX_DEPLOYMENT_TARGET : ' 10.13'
868
- working-directory : packages/next-swc
886
+ TURBO_TOKEN : ${{secrets.TURBO_TOKEN}}
887
+ TURBO_TEAM : nextjs
888
+ TURBO_PROJECT : nextjs
869
889
870
890
- name : Upload artifact
871
891
@@ -907,7 +927,7 @@ jobs:
907
927
# since the repo's dependencies aren't installed we need
908
928
# to install napi globally
909
929
-
run :
npm i -g @napi-rs/[email protected]
910
-
930
+
911
931
- name : Install Rust
912
932
uses : actions-rs/toolchain@v1
913
933
with :
@@ -916,18 +936,20 @@ jobs:
916
936
override : true
917
937
target : i686-pc-windows-msvc
918
938
919
- - name : Cache native binary
920
- id : binary-cache
921
- uses : actions/cache@v2
922
- with :
923
- path : packages/next-swc/native/next-swc.win32-ia32-msvc.node
924
- key : next-swc-nightly-2021-11-15-win32-ia32-msvc-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
939
+ # - name: Turbo Cache
940
+ # id: turbo-cache
941
+ # uses: actions/cache@v2
942
+ # with:
943
+ # path: .turbo
944
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
945
+ # restore-keys: |
946
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
947
+ # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
925
948
926
949
- name : Build
927
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
928
950
shell : bash
929
- run : yarn build-native --release --target i686-pc-windows-msvc
930
951
working-directory : packages/next-swc
952
+ run : yarn build-native --release --target i686-pc-windows-msvc
931
953
932
954
- name : Upload artifact
933
955
uses : actions/upload-artifact@v2
@@ -953,7 +975,7 @@ jobs:
953
975
# since the repo's dependencies aren't installed we need
954
976
# to install napi globally
955
977
-
run :
npm i -g @napi-rs/[email protected]
956
-
978
+
957
979
- name : Install Rust
958
980
uses : actions-rs/toolchain@v1
959
981
with :
@@ -962,18 +984,20 @@ jobs:
962
984
override : true
963
985
target : aarch64-pc-windows-msvc
964
986
965
- - name : Cache native binary
966
- id : binary-cache
967
- uses : actions/cache@v2
968
- with :
969
- path : packages/next-swc/native/next-swc.win32-arm64-msvc.node
970
- key : next-swc-nightly-2021-11-15-win32-arm64-msvc-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
987
+ # - name: Turbo Cache
988
+ # id: turbo-cache
989
+ # uses: actions/cache@v2
990
+ # with:
991
+ # path: .turbo
992
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
993
+ # restore-keys: |
994
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
995
+ # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
971
996
972
997
- name : Build
973
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
974
998
shell : bash
975
- run : yarn build-native --release --target aarch64-pc-windows-msvc
976
999
working-directory : packages/next-swc
1000
+ run : yarn build-native --release --target aarch64-pc-windows-msvc
977
1001
978
1002
- name : Upload artifact
979
1003
uses : actions/upload-artifact@v2
@@ -1011,17 +1035,19 @@ jobs:
1011
1035
docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
1012
1036
docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
1013
1037
1014
- - name : Cache native binary
1015
- id : binary-cache
1016
- uses : actions/cache@v2
1017
- with :
1018
- path : packages/next-swc/native/next-swc.linux-x64-musl.node
1019
- key : next-swc-nightly-2021-11-15-linux-x64-musl-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
1038
+ # - name: Turbo Cache
1039
+ # id: turbo-cache
1040
+ # uses: actions/cache@v2
1041
+ # with:
1042
+ # path: .turbo
1043
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
1044
+ # restore-keys: |
1045
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
1046
+ # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
1020
1047
1021
1048
- name : ' Build'
1022
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
1023
1049
run : |
1024
- docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/packages/next-swc:/build -w /build builder sh -c "npm i -g @napi-rs/[email protected] && yarn build-native --release --target x86_64-unknown-linux-musl"
1050
+ docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/packages/next-swc:/build -w /build builder sh -c "npm i -g @napi-rs/[email protected] && npm i -g [email protected] && yarn build-native --release --target x86_64-unknown-linux-musl"
1025
1051
1026
1052
- name : Upload artifact
1027
1053
uses : actions/upload-artifact@v2
@@ -1049,6 +1075,7 @@ jobs:
1049
1075
# since the repo's dependencies aren't installed we need
1050
1076
# to install napi globally
1051
1077
-
run :
npm i -g @napi-rs/[email protected]
1078
+
1052
1079
1053
1080
- name : Install Rust
1054
1081
uses : actions-rs/toolchain@v1
@@ -1070,17 +1097,20 @@ jobs:
1070
1097
sudo apt-get update
1071
1098
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
1072
1099
1073
- - name : Cache native binary
1074
- id : binary-cache
1075
- uses : actions/cache@v2
1076
- with :
1077
- path : packages/next-swc/native/next-swc.linux-arm64-gnu.node
1078
- key : next-swc-nightly-2021-11-15-linux-arm64-gnu-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
1100
+ # - name: Turbo Cache
1101
+ # id: turbo-cache
1102
+ # uses: actions/cache@v2
1103
+ # with:
1104
+ # path: .turbo
1105
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
1106
+ # restore-keys: |
1107
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
1108
+ # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
1079
1109
1080
1110
- name : Cross build aarch64
1111
+ working-directory : packages/next-swc
1081
1112
if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
1082
1113
run : yarn build-native --release --target aarch64-unknown-linux-gnu
1083
- working-directory : packages/next-swc
1084
1114
1085
1115
- name : Upload artifact
1086
1116
uses : actions/upload-artifact@v2
@@ -1106,7 +1136,7 @@ jobs:
1106
1136
# since the repo's dependencies aren't installed we need
1107
1137
# to install napi globally
1108
1138
-
run :
npm i -g @napi-rs/[email protected]
1109
-
1139
+
1110
1140
- name : Install Rust
1111
1141
uses : actions-rs/toolchain@v1
1112
1142
with :
@@ -1127,17 +1157,19 @@ jobs:
1127
1157
sudo apt-get update
1128
1158
sudo apt-get install gcc-aarch64-linux-gnu -y
1129
1159
1130
- - name : Cache native binary
1131
- id : binary-cache
1132
- uses : actions/cache@v2
1133
- with :
1134
- path : packages/next-swc/native/next-swc.linux-arm64-musl.node
1135
- key : next-swc-nightly-2021-11-15-linux-arm64-musl-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
1160
+ # - name: Turbo Cache
1161
+ # id: turbo-cache
1162
+ # uses: actions/cache@v2
1163
+ # with:
1164
+ # path: .turbo
1165
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
1166
+ # restore-keys: |
1167
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
1168
+ # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
1136
1169
1137
1170
- name : Cross build aarch64
1138
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
1139
- run : yarn build-native --release --target aarch64-unknown-linux-musl
1140
1171
working-directory : packages/next-swc
1172
+ run : yarn build-native --release --target aarch64-unknown-linux-musl
1141
1173
1142
1174
- name : Upload artifact
1143
1175
uses : actions/upload-artifact@v2
@@ -1165,6 +1197,7 @@ jobs:
1165
1197
# since the repo's dependencies aren't installed we need
1166
1198
# to install napi globally
1167
1199
-
run :
npm i -g @napi-rs/[email protected]
1200
+
1168
1201
1169
1202
- name : Install Rust
1170
1203
uses : actions-rs/toolchain@v1
@@ -1186,17 +1219,19 @@ jobs:
1186
1219
sudo apt-get update
1187
1220
sudo apt-get install gcc-arm-linux-gnueabihf -y
1188
1221
1189
- - name : Cache native binary
1190
- id : binary-cache
1191
- uses : actions/cache@v2
1192
- with :
1193
- path : packages/next-swc/native/next-swc.linux-arm-gnueabihf.node
1194
- key : next-swc-nightly-2021-11-15-linux-arm-gnueabihf-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
1222
+ # - name: Turbo Cache
1223
+ # id: turbo-cache
1224
+ # uses: actions/cache@v2
1225
+ # with:
1226
+ # path: .turbo
1227
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
1228
+ # restore-keys: |
1229
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
1230
+ # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
1195
1231
1196
1232
- name : Cross build aarch64
1197
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
1198
- run : yarn build-native --release --target armv7-unknown-linux-gnueabihf
1199
1233
working-directory : packages/next-swc
1234
+ run : yarn build-native --release --target armv7-unknown-linux-gnueabihf
1200
1235
1201
1236
- name : Upload artifact
1202
1237
uses : actions/upload-artifact@v2
@@ -1222,6 +1257,7 @@ jobs:
1222
1257
# since the repo's dependencies aren't installed we need
1223
1258
# to install napi globally
1224
1259
-
run :
npm i -g @napi-rs/[email protected]
1260
+
1225
1261
1226
1262
- name : Install Rust
1227
1263
uses : actions-rs/toolchain@v1
@@ -1231,20 +1267,22 @@ jobs:
1231
1267
override : true
1232
1268
target : aarch64-linux-android
1233
1269
1234
- - name : Cache native binary
1235
- id : binary-cache
1236
- uses : actions/cache@v2
1237
- with :
1238
- path : packages/next-swc/native/next-swc.android-arm64.node
1239
- key : next-swc-nightly-2021-11-15-android-arm64-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
1270
+ # - name: Turbo Cache
1271
+ # id: turbo-cache
1272
+ # uses: actions/cache@v2
1273
+ # with:
1274
+ # path: .turbo
1275
+ # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
1276
+ # restore-keys: |
1277
+ # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
1278
+ # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
1240
1279
1241
1280
- name : Build
1242
- if : ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
1243
1281
shell : bash
1282
+ working-directory : packages/next-swc
1244
1283
run : |
1245
1284
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang"
1246
1285
yarn build-native --release --target aarch64-linux-android
1247
- working-directory : packages/next-swc
1248
1286
1249
1287
- name : Upload artifact
1250
1288
uses : actions/upload-artifact@v2
0 commit comments