...

Text file src/github.com/docker/docker-credential-helpers/.github/workflows/build.yml

Documentation: github.com/docker/docker-credential-helpers/.github/workflows

     1name: build
     2
     3concurrency:
     4  group: ${{ github.workflow }}-${{ github.ref }}
     5  cancel-in-progress: true
     6
     7on:
     8  workflow_dispatch:
     9  push:
    10    branches:
    11      - 'master'
    12    tags:
    13      - 'v*'
    14  pull_request:
    15
    16env:
    17  DESTDIR: ./bin
    18  GO_VERSION: 1.20.6
    19
    20jobs:
    21  validate:
    22    runs-on: ubuntu-22.04
    23    strategy:
    24      fail-fast: false
    25      matrix:
    26        target:
    27          - lint
    28          - validate-vendor
    29    steps:
    30      -
    31        name: Checkout
    32        uses: actions/checkout@v3
    33      -
    34        name: Set up Docker Buildx
    35        uses: docker/setup-buildx-action@v2
    36      -
    37        name: Run
    38        run: |
    39          make ${{ matrix.target }}
    40
    41  test:
    42    runs-on: ${{ matrix.os }}
    43    strategy:
    44      fail-fast: false
    45      matrix:
    46        os:
    47          - ubuntu-22.04
    48          - ubuntu-20.04
    49          - macOS-11
    50          - windows-2022
    51    steps:
    52      -
    53        name: Checkout
    54        uses: actions/checkout@v3
    55      -
    56        name: Set up Go
    57        uses: actions/setup-go@v3
    58        with:
    59          go-version: ${{ env.GO_VERSION }}
    60          cache: true
    61      -
    62        name: Install deps (ubuntu)
    63        if: startsWith(matrix.os, 'ubuntu-')
    64        run: |
    65          sudo apt-get update
    66          sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass
    67      -
    68        name: Install deps (macOS)
    69        if: startsWith(matrix.os, 'macOS-')
    70        run: |
    71          brew install pass
    72      -
    73        name: GPG conf
    74        if: ${{ !startsWith(matrix.os, 'windows-') }}
    75        uses: actions/github-script@v6
    76        id: gpg
    77        with:
    78          script: |
    79            const fs = require('fs');
    80            const gnupgfolder = `${require('os').homedir()}/.gnupg`;
    81            if (!fs.existsSync(gnupgfolder)){
    82              fs.mkdirSync(gnupgfolder);
    83            }
    84            fs.copyFile('.github/workflows/fixtures/gpg.conf', `${gnupgfolder}/gpg.conf`, (err) => {
    85              if (err) throw err;
    86            });
    87            core.setOutput('key', fs.readFileSync('.github/workflows/fixtures/7D851EB72D73BDA0.key', {encoding: 'utf8'}));
    88            core.setOutput('passphrase', fs.readFileSync('.github/workflows/fixtures/7D851EB72D73BDA0.pass', {encoding: 'utf8'}));
    89      -
    90        name: Import GPG key
    91        if: ${{ !startsWith(matrix.os, 'windows-') }}
    92        uses: crazy-max/ghaction-import-gpg@v5
    93        with:
    94          gpg_private_key: ${{ steps.gpg.outputs.key }}
    95          passphrase: ${{ steps.gpg.outputs.passphrase }}
    96          trust_level: 5
    97      -
    98        name: Init pass
    99        if: ${{ !startsWith(matrix.os, 'windows-') }}
   100        run: |
   101          pass init 7D851EB72D73BDA0
   102        shell: bash
   103      -
   104        name: Test
   105        run: |
   106          make test COVERAGEDIR=${{ env.DESTDIR }}
   107        shell: bash
   108      -
   109        name: Upload coverage
   110        uses: codecov/codecov-action@v3
   111        with:
   112          file: ${{ env.DESTDIR }}/coverage.txt
   113
   114  test-sandboxed:
   115    runs-on: ubuntu-22.04
   116    steps:
   117      -
   118        name: Checkout
   119        uses: actions/checkout@v3
   120      -
   121        name: Set up Docker Buildx
   122        uses: docker/setup-buildx-action@v2
   123      -
   124        name: Test
   125        uses: docker/bake-action@v2
   126        with:
   127          targets: test
   128          set: |
   129            *.cache-from=type=gha,scope=test
   130            *.cache-to=type=gha,scope=test,mode=max
   131      -
   132        name: Upload coverage
   133        uses: codecov/codecov-action@v3
   134        with:
   135          file: ${{ env.DESTDIR }}//coverage.txt
   136
   137  build:
   138    runs-on: ubuntu-22.04
   139    steps:
   140      -
   141        name: Checkout
   142        uses: actions/checkout@v3
   143        with:
   144          fetch-depth: 0
   145      -
   146        name: Set up QEMU
   147        uses: docker/setup-qemu-action@v2
   148      -
   149        name: Set up Docker Buildx
   150        uses: docker/setup-buildx-action@v2
   151      -
   152        name: Build
   153        run: |
   154          make release
   155        env:
   156          CACHE_FROM: type=gha,scope=build
   157          CACHE_TO: type=gha,scope=build,mode=max
   158      -
   159        name: List artifacts
   160        run: |
   161          tree -nh ${{ env.DESTDIR }}
   162      -
   163        name: Check artifacts
   164        run: |
   165          find ${{ env.DESTDIR }} -type f -exec file -e ascii -e text -- {} +
   166      -
   167        name: Upload artifacts
   168        uses: actions/upload-artifact@v3
   169        with:
   170          name: docker-credential-helpers
   171          path: ${{ env.DESTDIR }}/*
   172          if-no-files-found: error
   173      -
   174        name: GitHub Release
   175        if: startsWith(github.ref, 'refs/tags/v')
   176        uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
   177        env:
   178          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   179        with:
   180          draft: true
   181          files: ${{ env.DESTDIR }}/*
   182
   183  build-deb:
   184    runs-on: ubuntu-22.04
   185    steps:
   186      -
   187        name: Checkout
   188        uses: actions/checkout@v3
   189        with:
   190          fetch-depth: 0
   191      -
   192        name: Build
   193        run: |
   194          make deb

View as plain text