mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-14 00:11:28 +05:30
9ec715d8ed
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
156 lines
4.0 KiB
YAML
156 lines
4.0 KiB
YAML
name: build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
|
|
env:
|
|
DESTDIR: ./bin
|
|
GO_VERSION: 1.18.5
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- lint
|
|
- validate-vendor
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
-
|
|
name: Run
|
|
run: |
|
|
make ${{ matrix.target }}
|
|
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-20.04
|
|
- macOS-11
|
|
- windows-2022
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
cache: true
|
|
-
|
|
name: Install deps
|
|
if: ${{ matrix.os == 'ubuntu-20.04' }}
|
|
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
|
|
-
|
|
name: Upload coverage
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.txt
|
|
|
|
test-sandboxed:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
-
|
|
name: Test
|
|
uses: docker/bake-action@v2
|
|
with:
|
|
targets: test
|
|
set: |
|
|
*.cache-from=type=gha,scope=test
|
|
*.cache-to=type=gha,scope=test,mode=max
|
|
-
|
|
name: Upload coverage
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ${{ env.DESTDIR }}//coverage.txt
|
|
|
|
build:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
-
|
|
name: Build
|
|
uses: docker/bake-action@v2
|
|
with:
|
|
targets: binaries
|
|
set: |
|
|
*.cache-from=type=gha,scope=build
|
|
*.cache-to=type=gha,scope=build,mode=max
|
|
-
|
|
name: Move artifacts
|
|
run: |
|
|
mv ${{ env.DESTDIR }}/**/* ${{ env.DESTDIR }}/
|
|
-
|
|
name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: docker-credential-helpers
|
|
path: ${{ env.DESTDIR }}/*
|
|
if-no-files-found: error
|