1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

ci: init gpg key and pass for tests

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-08-21 15:31:52 +02:00
parent 9582eb6661
commit 9ec715d8ed
7 changed files with 225 additions and 10 deletions
+28
View File
@@ -59,9 +59,37 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass
-
name: GPG conf
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: actions/github-script@v6
id: gpg
with:
script: |
const fs = require('fs');
const gnupgfolder = `${require('os').homedir()}/.gnupg`;
if (!fs.existsSync(gnupgfolder)){
fs.mkdirSync(gnupgfolder);
}
fs.copyFile('.github/workflows/fixtures/gpg.conf', `${gnupgfolder}/gpg.conf`, (err) => {
if (err) throw err;
});
core.setOutput('key', fs.readFileSync('.github/workflows/fixtures/7D851EB72D73BDA0.key', {encoding: 'utf8'}));
core.setOutput('passphrase', fs.readFileSync('.github/workflows/fixtures/7D851EB72D73BDA0.pass', {encoding: 'utf8'}));
-
name: Import GPG key
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ steps.gpg.outputs.key }}
passphrase: ${{ steps.gpg.outputs.passphrase }}
-
name: Test
run: |
if [ "${{ matrix.os }}" = "ubuntu-20.04" ]; then
echo -e "trust\n5\ny" | gpg --batch --no-tty --command-fd 0 --edit-key 7D851EB72D73BDA0
pass init 7D851EB72D73BDA0
fi
go test -short -v -coverprofile=./coverage.txt -covermode=atomic ./...
go tool cover -func=./coverage.txt
shell: bash