Add support for custom SSH config #304
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Test and lint | |
on: | |
push: | |
branches: [ "main", "v[0-9]+.[0-9]+.x", "v[0-9]+.x" ] | |
pull_request: | |
branches: [ "main", "v[0-9]+.[0-9]+.x", "v[0-9]+.x" ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- run: npm ci | |
# Set up SSH access, as the test suite needs to be able to access git | |
# repos to validate functionality. | |
- name: Decrypt secrets | |
env: | |
PASSWORD: ${{ secrets.SSH_ENCRYPTION_KEY }} | |
run: | | |
gpg --batch --passphrase $PASSWORD --output .github/workflows/secrets/id_ed25519 --decrypt .github/workflows/secrets/id_ed25519.enc | |
- name: Setup SSH agent | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
chmod 0600 .github/workflows/secrets/id_ed25519 | |
ssh-add .github/workflows/secrets/id_ed25519 | |
- name: Set up git config | |
run: | | |
git config --global user.name "MadGutsBot" | |
git config --global user.email "103484332+MadGutsBot@users.noreply.github.com" | |
- name: Set up .env | |
run: cp .env.example .env | |
- name: Run test suite | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: npm test | |
- name: Show server output | |
if: always() | |
run: cat server.log | |
- name: Cleanup SSH Agent | |
if: always() | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
ssh-add -D | |
rm -Rf ~/.ssh | |
rm .github/workflows/secrets/id_ed25519 | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- run: npm ci | |
- name: Run linting | |
run: npm run lint | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- run: npm ci | |
- name: Run type-checking | |
run: npm run check |