github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/.github/workflows/build.yaml (about)

     1  name: Build and run testsuite
     2  on:
     3    push:
     4      branches:
     5        - master
     6    pull_request:
     7      branches:
     8        - '**'
     9  jobs:
    10    build_test:
    11      name: Build & Test
    12      runs-on: ${{ matrix.os }}
    13      strategy:
    14        matrix:
    15          include:
    16            - {os: ubuntu-latest, go: 1.13}
    17            - {os: ubuntu-latest, go: 1.15}
    18            - {os: windows-latest, go: 1.15}
    19            - {os: macos-latest, go: 1.15}
    20      steps:
    21        - name: Checkout
    22          uses: actions/checkout@master
    23        - uses: actions/setup-go@v2
    24          with:
    25            go-version: ${{ matrix.go }}
    26        - name: Build
    27          run: |
    28            make
    29        - name: Run tests
    30          run: |
    31            make TEST_FLAGS="-timeout 60s -coverprofile cover.out -race -v" test
    32        - uses: actions/upload-artifact@v2
    33          with:
    34            name: vcn-${{ matrix.os }}-go-${{ matrix.go }}
    35            path: ${{ github.workspace }}/vcn*
    36    cnil_integration_test:
    37      name: CNIL integration test
    38      needs: build_test
    39      runs-on: ${{ matrix.os }}
    40      strategy:
    41        matrix:
    42          include:
    43            - {os: ubuntu-latest, go: 1.13, exe: vcn}
    44            - {os: ubuntu-latest, go: 1.15, exe: vcn}
    45            - {os: windows-latest, go: 1.15, exe: vcn.exe}
    46            - {os: macos-latest, go: 1.15, exe: vcn}
    47      env:
    48        CNIL_GITHUB_TEST_API_KEY: ${{ secrets.CNIL_GITHUB_TEST_API_KEY }}
    49        CNIL_GITHUB_TEST_HOST: ${{ secrets.CNIL_GITHUB_TEST_HOST }}
    50        CNIL_GITHUB_TEST_PORT: ${{ secrets.CNIL_GITHUB_TEST_PORT }}
    51      steps:
    52        - uses: actions/download-artifact@v2
    53          with:
    54            name: vcn-${{ matrix.os }}-go-${{ matrix.go }}
    55            path: ${{ github.workspace }}/bin
    56        - name: Set permissions on vcn executable
    57          run: |
    58            chmod +x ${GITHUB_WORKSPACE}/bin/*
    59          shell: bash
    60          if: runner.os == 'Linux' || runner.os == 'MacOS'
    61        - name: Test vcn operations
    62          shell: bash
    63          run: |
    64            export PATH=$PATH:${GITHUB_WORKSPACE}/bin
    65            export VCN_LC_API_KEY=${CNIL_GITHUB_TEST_API_KEY}
    66  
    67            echo "This is some content" > README.txt
    68  
    69            ${{ matrix.exe }} login --lc-host=${CNIL_GITHUB_TEST_HOST} --lc-port=${CNIL_GITHUB_TEST_PORT}
    70            ${{ matrix.exe }} n README.txt --lc-host=${CNIL_GITHUB_TEST_HOST} --lc-port=${CNIL_GITHUB_TEST_PORT}
    71            ${{ matrix.exe }} a -s github README.txt --lc-host=${CNIL_GITHUB_TEST_HOST} --lc-port=${CNIL_GITHUB_TEST_PORT}
    72  
    73            # with CI attributes and attachments
    74            ${{ matrix.exe }} n README.txt --lc-host=${CNIL_GITHUB_TEST_HOST} --lc-port=${CNIL_GITHUB_TEST_PORT} --ci-attr --attach README.txt
    75  
    76            # unknown signer
    77            ${{ matrix.exe }} a -s unknown README.txt --lc-host=${CNIL_GITHUB_TEST_HOST} --lc-port=${CNIL_GITHUB_TEST_PORT} || retval=$?
    78            test $retval -eq 2
    79  
    80            # revoked signer
    81            ${{ matrix.exe }} a -s new-revoked README.txt --lc-host=${CNIL_GITHUB_TEST_HOST} --lc-port=${CNIL_GITHUB_TEST_PORT} || retval=$?
    82            test $retval -eq 4
    83    cn_io_integration_test:
    84      name: CodeNotary.io integration test
    85      needs: build_test
    86      runs-on: ${{ matrix.os }}
    87      strategy:
    88        matrix:
    89          include:
    90            - {os: ubuntu-latest, go: 1.13, exe: vcn}
    91            - {os: ubuntu-latest, go: 1.15, exe: vcn}
    92            - {os: windows-latest, go: 1.15, exe: vcn.exe}
    93            - {os: macos-latest, go: 1.15, exe: vcn}
    94      env:
    95        VCN_USER: ${{ secrets.CODENOTARY_IO_VCN_USER }}
    96        VCN_PASSWORD: ${{ secrets.CODENOTARY_IO_VCN_PASSWORD }}
    97        VCN_NOTARIZATION_PASSWORD: ${{ secrets.CODENOTARY_IO_VCN_PASSWORD }}
    98      steps:
    99        - uses: actions/download-artifact@v2
   100          with:
   101            name: vcn-${{ matrix.os }}-go-${{ matrix.go }}
   102            path: ${{ github.workspace }}/bin
   103        - name: Set permissions on vcn executable
   104          run: |
   105            chmod +x ${GITHUB_WORKSPACE}/bin/*
   106          shell: bash
   107          if: runner.os == 'Linux' || runner.os == 'MacOS'
   108        - name: Test vcn operations
   109          shell: bash
   110          run: |
   111            export PATH=$PATH:${GITHUB_WORKSPACE}/bin
   112            export VCN_OTP_EMPTY=1
   113  
   114            echo "This is some content generated in ${GITHUB_ACTION}, ${GITHUB_JOB}, ${GITHUB_RUN_NUMBER}, ${GITHUB_SHA} on ${{ matrix.os }}-${{ matrix.go }}" > README.txt
   115            echo "This is some other content" > UNKNOWN.txt
   116  
   117            ${{ matrix.exe }} login
   118            ${{ matrix.exe }} n README.txt
   119            ${{ matrix.exe }} a README.txt
   120  
   121            # not notarized
   122            ${{ matrix.exe }} a UNKNOWN.txt || retval=$?
   123            test $retval -eq 2