run 1password tests in CI #22
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
name: Tests | |
on: | |
workflow_call: | |
secrets: | |
AWS_ACCESS_KEY_ID: | |
required: true | |
AWS_SECRET_ACCESS_KEY: | |
required: true | |
GOOGLE_TEST_SERVICE_KEY: | |
required: true | |
GOOGLE_CLOUD_PROJECT: | |
required: true | |
OP_SERVICE_ACCOUNT_TOKEN: | |
required: true | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x, 21.x, 22.x, 23.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install KeePassXC | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y keepassxc | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Setup Google Cloud credentials | |
run: | | |
echo '${{ secrets.GOOGLE_TEST_SERVICE_KEY }}' > /tmp/google-credentials.json | |
- name: Set 1Password service account token | |
run: | | |
echo "OP_SERVICE_ACCOUNT_TOKEN=${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}" >> $GITHUB_ENV | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Run tests | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: /tmp/google-credentials.json | |
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }} | |
AWS_REGION: us-east-1 | |
run: npm test |