44 DEBUG : napi:*
55 APP_NAME : python-node
66 MACOSX_DEPLOYMENT_TARGET : ' 10.13'
7+ CARGO_NET_GIT_FETCH_WITH_CLI : ' true'
78
89permissions :
910 contents : write
2324 - docs/**
2425 pull_request :
2526
27+ concurrency :
28+ group : ${{ github.workflow }}-${{ github.ref }}-ci
29+ cancel-in-progress : true
30+
2631jobs :
2732 build :
2833 strategy :
9095 run : |
9196 set -x
9297
98+ export CARGO_NET_GIT_FETCH_WITH_CLI=true
99+
93100 # Install apt dependencies
94101 apt-get update -y
95102 apt-get install -y openssh-client
@@ -98,16 +105,39 @@ jobs:
98105 corepack disable
99106 npm i -gf pnpm
100107
101- # Set up SSH key (to checkout private repos with cargo)
108+ # Set up SSH keys (to checkout private repos with cargo)
102109 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
110+ chmod 700 ~/.ssh
111+
112+ # Save SSH keys to files
113+ echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_handler_key
114+ echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_rewriter_key
115+ chmod 600 ~/.ssh/http_handler_key
116+ chmod 600 ~/.ssh/http_rewriter_key
117+
118+ # Add GitHub to known hosts
109119 ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
110120
121+ # Create SSH config
122+ cat > ~/.ssh/config <<'EOF'
123+ Host github-http-handler
124+ HostName github.com
125+ User git
126+ IdentityFile ~/.ssh/http_handler_key
127+ IdentitiesOnly yes
128+
129+ Host github-http-rewriter
130+ HostName github.com
131+ User git
132+ IdentityFile ~/.ssh/http_rewriter_key
133+ IdentitiesOnly yes
134+ EOF
135+ chmod 600 ~/.ssh/config
136+
137+ # Configure git to use the correct SSH hosts
138+ git config --global url."git@github-http-handler:platformatic/http-handler.git".insteadOf "git@github.com:platformatic/http-handler.git"
139+ git config --global url."git@github-http-rewriter:platformatic/http-rewriter.git".insteadOf "git@github.com:platformatic/http-rewriter.git"
140+
111141 ${{ matrix.settings.build }}
112142 - name : Build
113143 run : ${{ matrix.settings.build }}
@@ -232,6 +262,8 @@ jobs:
232262 run : |
233263 set -x
234264
265+ export CARGO_NET_GIT_FETCH_WITH_CLI=true
266+
235267 # Install apt dependencies
236268 apt-get update -y
237269 apt-get install -y openssh-client curl
@@ -240,16 +272,39 @@ jobs:
240272 curl https://sh.rustup.rs -sSf | bash -s -- -y -t ${{ matrix.settings.target }}
241273 source "$HOME/.cargo/env"
242274
243- # Set up SSH key (to checkout private repos with cargo)
275+ # Set up SSH keys (to checkout private repos with cargo)
244276 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
277+ chmod 700 ~/.ssh
278+
279+ # Save SSH keys to files
280+ echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_handler_key
281+ echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/http_rewriter_key
282+ chmod 600 ~/.ssh/http_handler_key
283+ chmod 600 ~/.ssh/http_rewriter_key
284+
285+ # Add GitHub to known hosts
251286 ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
252287
288+ # Create SSH config
289+ cat > ~/.ssh/config <<'EOF'
290+ Host github-http-handler
291+ HostName github.com
292+ User git
293+ IdentityFile ~/.ssh/http_handler_key
294+ IdentitiesOnly yes
295+
296+ Host github-http-rewriter
297+ HostName github.com
298+ User git
299+ IdentityFile ~/.ssh/http_rewriter_key
300+ IdentitiesOnly yes
301+ EOF
302+ chmod 600 ~/.ssh/config
303+
304+ # Configure git to use the correct SSH hosts
305+ git config --global url."git@github-http-handler:platformatic/http-handler.git".insteadOf "git@github.com:platformatic/http-handler.git"
306+ git config --global url."git@github-http-rewriter:platformatic/http-rewriter.git".insteadOf "git@github.com:platformatic/http-rewriter.git"
307+
253308 cargo test --target ${{ matrix.settings.target }}
254309 - name : Test bindings
255310 uses : addnab/docker-run-action@v3
0 commit comments