github.com/hyperledger/aries-framework-go@v0.3.2/.github/workflows/build.yml (about)

     1  #
     2  # Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  #
     4  # SPDX-License-Identifier: Apache-2.0
     5  #
     6  name: build
     7  on:
     8    push:
     9      branches-ignore:
    10      - 'dependabot/**'
    11    pull_request:
    12  jobs:
    13    unitTest:
    14      name: Unit test
    15      runs-on: ${{ matrix.os }}
    16      timeout-minutes: 15
    17      strategy:
    18        matrix:
    19          os: [ubuntu-22.04, macOS-10.15]
    20      steps:
    21  
    22      - name: Setup Go 1.19
    23        uses: actions/setup-go@v2
    24        with:
    25          go-version: 1.19
    26        id: go
    27  
    28      - uses: actions/checkout@v3
    29  
    30      - name: Skip tests that require Docker on macOS (issue-2183)
    31        if: matrix.os == 'macOS-10.15'
    32        run: echo "SKIP_DOCKER=true" >> $GITHUB_ENV
    33  
    34      - name: Run unit test
    35        timeout-minutes: 15
    36        run: make unit-test
    37  
    38      - name: Upload coverage to Codecov
    39        timeout-minutes: 10
    40        if: matrix.os == 'ubuntu-22.04' && github.repository == 'hyperledger/aries-framework-go'
    41        uses: codecov/codecov-action@v2.1.0
    42        with:
    43          file: ./coverage.out
    44  
    45    unitTestUrsa:
    46      name: Unit test (Ursa/CL)
    47      runs-on: ubuntu-22.04
    48      container:
    49        image: ghcr.io/hyperledger/ursa-wrapper-go/uwg-build # a container with libursa installed
    50      timeout-minutes: 15
    51      steps:
    52        - name: Setup Go 1.19
    53          uses: actions/setup-go@v2
    54          with:
    55            go-version: 1.19
    56          id: go
    57  
    58        - uses: actions/checkout@v3
    59  
    60        - name: Run unit test (Ursa/CL)
    61          timeout-minutes: 15
    62          run: make unit-test-ursa
    63  
    64    unitTestMobile:
    65      name: Unit test (mobile)
    66      runs-on: ubuntu-22.04
    67      timeout-minutes: 15
    68      steps:
    69  
    70        - name: Setup Go 1.19
    71          uses: actions/setup-go@v2
    72          with:
    73            go-version: 1.19
    74          id: go
    75  
    76        - uses: actions/checkout@v3
    77  
    78        - name: Run unit test
    79          timeout-minutes: 15
    80          run: make unit-test-mobile
    81  
    82    unitTestWasm:
    83      name: Unit test wasm
    84      runs-on: ubuntu-22.04
    85      timeout-minutes: 10
    86      steps:
    87  
    88        - name: Setup Go 1.19
    89          uses: actions/setup-go@v2
    90          with:
    91            go-version: 1.19
    92          id: go
    93  
    94        - uses: actions/checkout@v3
    95  
    96        - name: Run unit test wasm
    97          timeout-minutes: 10
    98          run: make unit-test-wasm
    99  
   100    bddTest:
   101      name: BDD test
   102      runs-on: ubuntu-22.04
   103      timeout-minutes: 45
   104      steps:
   105  
   106        - name: Setup Go 1.19
   107          uses: actions/setup-go@v2
   108          with:
   109            go-version: 1.19
   110          id: go
   111  
   112        - name: Setup Node.js
   113          uses: actions/setup-node@v3.4.1
   114          with:
   115            node-version: 12.14.x
   116            registry-url: "https://npm.pkg.github.com"
   117  
   118        - uses: actions/checkout@v3
   119  
   120        - name: Run BDD test
   121          timeout-minutes: 45
   122          run: |
   123            make bdd-test
   124        - uses: actions/upload-artifact@v2
   125          if: always()
   126          with:
   127            name: logs
   128            path: test/bdd/docker-compose.log
   129  
   130    repoLint:
   131      name: repolint
   132      runs-on: ubuntu-22.04
   133      steps:
   134        - uses: actions/checkout@v3
   135        - name: repolinter
   136          uses: philips-labs/github-action-repolinter@v1.0.0
   137          env:
   138            CUSTOM_REPOLINT_FILE: .repolint.json
   139  
   140    checks:
   141      name: Checks
   142      timeout-minutes: 15
   143      runs-on: ubuntu-22.04
   144      steps:
   145        - name: Setup Go 1.19
   146          uses: actions/setup-go@v2
   147          with:
   148            go-version: 1.19
   149  
   150        - uses: actions/checkout@v3
   151  
   152        - name: Run checks
   153          timeout-minutes: 10
   154          run: make checks
   155  
   156    publish:
   157      name: Publish images and npm packages
   158      if: github.event_name == 'push' && ((github.repository == 'hyperledger/aries-framework-go' && github.ref == 'refs/heads/main') || (github.repository != 'hyperledger/aries-framework-go' && github.ref == 'refs/heads/afg-publish'))
   159      needs: [repoLint, checks, unitTest, unitTestWasm, bddTest]
   160      runs-on: ubuntu-22.04
   161      timeout-minutes: 10
   162      steps:
   163        - name: Setup Go 1.19
   164          uses: actions/setup-go@v2
   165          with:
   166            go-version: 1.19
   167          id: go
   168  
   169        - name: Setup Node.js
   170          uses: actions/setup-node@v3.4.1
   171          with:
   172            node-version: 12.14.x
   173            registry-url: "https://npm.pkg.github.com"
   174  
   175        - uses: actions/checkout@v3
   176  
   177        - name: Publish docker images
   178          run: |
   179                function logout {
   180                  docker logout ghcr.io
   181                }
   182                trap logout EXIT
   183                source .github/workflows/version_var.sh
   184                if [ "${IS_RELEASE}" = true ] || [ "${GITHUB_REF}" =  "refs/heads/afg-publish" ]; then
   185                  echo ${{ secrets.CR_PAT }} | docker login ghcr.io --username ${{ secrets.CR_USER }} --password-stdin
   186                  make agent-rest-docker
   187                  docker tag aries-framework-go/agent-rest:latest ghcr.io/${GITHUB_REPOSITORY}:$AGENT_IMAGE_TAG
   188                  docker push ghcr.io/${GITHUB_REPOSITORY}:$AGENT_IMAGE_TAG
   189                fi
   190  
   191        - name: Publish npm packages
   192          working-directory: ./cmd/aries-js-worker
   193          run: |
   194            source ../../.github/workflows/version_var.sh
   195            if [ "${IS_RELEASE}" = true ] || [ "${GITHUB_REF}" =  "refs/heads/afg-publish" ]; then
   196              sed -i 's/"version": "0.0.1"/"version": "'$NPM_PKG_TAG'"/g' package.json
   197              sed -i 's#"name": "@hyperledger/aries-framework-go"#"name": "@'${GITHUB_REPOSITORY}'"#g' package.json
   198              sed -i 's#"url": "git://github.com/hyperledger/aries-framework-go.git"#"url": "git://github.com/'${GITHUB_REPOSITORY}'.git"#g' package.json
   199              npm install
   200              npm publish
   201            fi
   202          env:
   203            NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}