diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6ab8dfd..c740f63 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,35 @@ on: push name: Run acceptance tests jobs: - test-connect-output: + use-connect-without-export-env: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Launch 1Password Connect instance + env: + OP_CONNECT_CREDENTIALS: ${{ secrets.OP_CONNECT_CREDENTIALS }} + run: | + echo "$OP_CONNECT_CREDENTIALS" > 1password-credentials.json + docker-compose -f tests/fixtures/docker-compose.yml up -d && sleep 10 + - name: Configure 1Password Connect + uses: ./configure # 1password/load-secrets-action/configure@ + with: + connect-host: http://localhost:8080 + connect-token: ${{ secrets.OP_CONNECT_TOKEN }} + - name: Load secrets + id: load_secrets + uses: ./ # 1password/load-secrets-action@ + env: + SECRET: op://acceptance-tests/test-secret/password + SECRET_IN_SECTION: op://acceptance-tests/test-secret/test-section/password + MULTILINE_SECRET: op://acceptance-tests/multiline-secret/notesPlain + - name: Assert test secret values + env: + SECRET: ${{ steps.load_secrets.outputs.SECRET }} + SECRET_IN_SECTION: ${{ steps.load_secrets.outputs.SECRET_IN_SECTION }} + MULTILINE_SECRET: ${{ steps.load_secrets.outputs.MULTILINE_SECRET }} + run: ./tests/assert-env-set.sh + use-connect-with-export-env: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -27,10 +55,6 @@ jobs: SECRET_IN_SECTION: op://acceptance-tests/test-secret/test-section/password MULTILINE_SECRET: op://acceptance-tests/multiline-secret/notesPlain - name: Assert test secret values - env: - SECRET: ${{ steps.load_secrets.outputs.SECRET }} - SECRET_IN_SECTION: ${{ steps.load_secrets.outputs.SECRET_IN_SECTION }} - MULTILINE_SECRET: ${{ steps.load_secrets.outputs.MULTILINE_SECRET }} run: ./tests/assert-env-set.sh test-connect-export: runs-on: ubuntu-latest @@ -65,7 +89,7 @@ jobs: unset-previous: true - name: Assert removed secrets run: ./tests/assert-env-unset.sh - test-op-cli-load-secrets: + use-service-account-without-export-env: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -83,3 +107,19 @@ jobs: SECRET_IN_SECTION: ${{ steps.load_secrets.outputs.SECRET_IN_SECTION }} MULTILINE_SECRET: ${{ steps.load_secrets.outputs.MULTILINE_SECRET }} run: ./tests/assert-env-set.sh + use-service-account-with-export-env: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Load secrets + id: load_secrets + uses: ./ # 1password/load-secrets-action@ + with: + export-env: true + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + SECRET: op://acceptance-tests/test-secret/password + SECRET_IN_SECTION: op://acceptance-tests/test-secret/test-section/password + MULTILINE_SECRET: op://acceptance-tests/multiline-secret/notesPlain + - name: Assert test secret values + run: ./tests/assert-env-set.sh