Skip to content

Commit

Permalink
Ensure ssh-agent is started
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvincent committed Feb 12, 2024
1 parent d72a9ee commit d98cefd
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,42 @@ jobs:

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Setup gpg-agent
run: |
gpg-agent --daemon || true
# The default version of openssh on windows server is quite old (8.1) and doesn't have
# all the necessary signing/verification commands available
- name: Setup ssh-agent [windows]
if: ${{ matrix.os == 'windows-latest' }}
run: |
Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
choco install openssh --pre
$sshAgentOutput = ssh-agent -s | Out-String
if ($sshAgentOutput -match 'SSH_AUTH_SOCK=(.+?); export SSH_AUTH_SOCK;') {
"SSH_AUTH_SOCK=$($matches[1])" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
}
if ($sshAgentOutput -match 'SSH_AGENT_PID=([0-9]+); export SSH_AGENT_PID;') {
"SSH_AGENT_PID=$($matches[1])" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
}
- name: Setup ssh-agent [unix]
if: ${{ matrix.os != 'windows-latest' }}
run: |
eval "$(ssh-agent -s)"
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> "$GITHUB_ENV"
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> "$GITHUB_ENV"
- name: Install Rust
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8
with:
toolchain: 1.71
- name: Build
run: cargo build --workspace --all-targets --verbose ${{ matrix.cargo_flags }}
- name: Start Signing Agents
run: |
source <(gpg-agent --daemon)
eval `ssh-agent -s`
- name: Test
run: cargo test --workspace --all-targets --verbose ${{ matrix.cargo_flags }}
env:
Expand Down

0 comments on commit d98cefd

Please sign in to comment.