|
4 | 4 | DEBUG: napi:* |
5 | 5 | APP_NAME: python-node |
6 | 6 | MACOSX_DEPLOYMENT_TARGET: '10.13' |
| 7 | + CARGO_NET_GIT_FETCH_WITH_CLI: 'true' |
7 | 8 |
|
8 | 9 | permissions: |
9 | 10 | contents: write |
|
23 | 24 | - docs/** |
24 | 25 | pull_request: |
25 | 26 |
|
| 27 | +concurrency: |
| 28 | + group: ${{ github.workflow }}-${{ github.ref }}-ci |
| 29 | + cancel-in-progress: true |
| 30 | + |
26 | 31 | jobs: |
27 | 32 | build: |
28 | 33 | strategy: |
@@ -98,16 +103,39 @@ jobs: |
98 | 103 | corepack disable |
99 | 104 | npm i -gf pnpm |
100 | 105 |
|
101 | | - # Set up SSH key (to checkout private repos with cargo) |
| 106 | + # Set up SSH keys (to checkout private repos with cargo) |
102 | 107 | mkdir -p ~/.ssh |
103 | | - chmod -R 400 ~/.ssh |
104 | | - touch ~/.ssh/config ~/.ssh/known_hosts |
105 | | - eval `ssh-agent -s` |
106 | | - echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add - |
107 | | - echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add - |
108 | | - ssh-add -l |
| 108 | + chmod 700 ~/.ssh |
| 109 | +
|
| 110 | + # Save SSH keys to files |
| 111 | + echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_handler_key |
| 112 | + echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_rewriter_key |
| 113 | + chmod 600 ~/.ssh/http_handler_key |
| 114 | + chmod 600 ~/.ssh/http_rewriter_key |
| 115 | +
|
| 116 | + # Add GitHub to known hosts |
109 | 117 | ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts |
110 | 118 |
|
| 119 | + # Create SSH config |
| 120 | + cat > ~/.ssh/config <<'EOF' |
| 121 | + Host github-http-handler |
| 122 | + HostName github.com |
| 123 | + User git |
| 124 | + IdentityFile ~/.ssh/http_handler_key |
| 125 | + IdentitiesOnly yes |
| 126 | +
|
| 127 | + Host github-http-rewriter |
| 128 | + HostName github.com |
| 129 | + User git |
| 130 | + IdentityFile ~/.ssh/http_rewriter_key |
| 131 | + IdentitiesOnly yes |
| 132 | + EOF |
| 133 | + chmod 600 ~/.ssh/config |
| 134 | +
|
| 135 | + # Configure git to use the correct SSH hosts |
| 136 | + git config --global url."git@github-http-handler:platformatic/http-handler.git".insteadOf "git@github.com:platformatic/http-handler.git" |
| 137 | + git config --global url."git@github-http-rewriter:platformatic/http-rewriter.git".insteadOf "git@github.com:platformatic/http-rewriter.git" |
| 138 | +
|
111 | 139 | ${{ matrix.settings.build }} |
112 | 140 | - name: Build |
113 | 141 | run: ${{ matrix.settings.build }} |
@@ -240,16 +268,39 @@ jobs: |
240 | 268 | curl https://sh.rustup.rs -sSf | bash -s -- -y -t ${{ matrix.settings.target }} |
241 | 269 | source "$HOME/.cargo/env" |
242 | 270 |
|
243 | | - # Set up SSH key (to checkout private repos with cargo) |
| 271 | + # Set up SSH keys (to checkout private repos with cargo) |
244 | 272 | mkdir -p ~/.ssh |
245 | | - chmod -R 400 ~/.ssh |
246 | | - touch ~/.ssh/config ~/.ssh/known_hosts |
247 | | - eval `ssh-agent -s` |
248 | | - echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add - |
249 | | - echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add - |
250 | | - ssh-add -l |
| 273 | + chmod 700 ~/.ssh |
| 274 | +
|
| 275 | + # Save SSH keys to files |
| 276 | + echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_handler_key |
| 277 | + echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_rewriter_key |
| 278 | + chmod 600 ~/.ssh/http_handler_key |
| 279 | + chmod 600 ~/.ssh/http_rewriter_key |
| 280 | +
|
| 281 | + # Add GitHub to known hosts |
251 | 282 | ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts |
252 | 283 |
|
| 284 | + # Create SSH config |
| 285 | + cat > ~/.ssh/config <<'EOF' |
| 286 | + Host github-http-handler |
| 287 | + HostName github.com |
| 288 | + User git |
| 289 | + IdentityFile ~/.ssh/http_handler_key |
| 290 | + IdentitiesOnly yes |
| 291 | +
|
| 292 | + Host github-http-rewriter |
| 293 | + HostName github.com |
| 294 | + User git |
| 295 | + IdentityFile ~/.ssh/http_rewriter_key |
| 296 | + IdentitiesOnly yes |
| 297 | + EOF |
| 298 | + chmod 600 ~/.ssh/config |
| 299 | +
|
| 300 | + # Configure git to use the correct SSH hosts |
| 301 | + git config --global url."git@github-http-handler:platformatic/http-handler.git".insteadOf "git@github.com:platformatic/http-handler.git" |
| 302 | + git config --global url."git@github-http-rewriter:platformatic/http-rewriter.git".insteadOf "git@github.com:platformatic/http-rewriter.git" |
| 303 | +
|
253 | 304 | cargo test --target ${{ matrix.settings.target }} |
254 | 305 | - name: Test bindings |
255 | 306 | uses: addnab/docker-run-action@v3 |
|
0 commit comments