|
| 1 | +name: porter/porter |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + paths-ignore: |
| 7 | + - 'docs/**' |
| 8 | +env: |
| 9 | + GOVERSION: 1.20.7 |
| 10 | + |
| 11 | +jobs: |
| 12 | + Build: |
| 13 | + name: Native Compile |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: checkout |
| 17 | + uses: actions/checkout@v3.5.0 |
| 18 | + - uses: actions/setup-go@v4 |
| 19 | + with: |
| 20 | + go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. |
| 21 | + - run: go version |
| 22 | + - name: Native Build |
| 23 | + run: go run mage.go build |
| 24 | + shell: bash |
| 25 | + - name: Publish Native Binaries |
| 26 | + uses: actions/upload-artifact@v3.1.1 |
| 27 | + with: |
| 28 | + name: build-bin |
| 29 | + path: "${{ github.workspace }}/bin" |
| 30 | + |
| 31 | + XBuild: |
| 32 | + name: Cross Compile |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: checkout |
| 36 | + uses: actions/checkout@v3.5.0 |
| 37 | + - uses: actions/setup-go@v4 |
| 38 | + with: |
| 39 | + go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. |
| 40 | + - run: go version |
| 41 | + - name: Cross Compile |
| 42 | + run: go run mage.go -v XBuildAll |
| 43 | + shell: bash |
| 44 | + - name: Publish Release Binaries |
| 45 | + uses: actions/upload-artifact@v3.1.1 |
| 46 | + with: |
| 47 | + name: xbuild-bin |
| 48 | + path: "${{ github.workspace }}/bin" |
| 49 | + |
| 50 | + Unit_test: |
| 51 | + name: Unit Test |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: checkout |
| 55 | + uses: actions/checkout@v3.5.0 |
| 56 | + - uses: actions/setup-go@v4 |
| 57 | + with: |
| 58 | + go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. |
| 59 | + - run: go version |
| 60 | + - name: Unit Test |
| 61 | + run: go run mage.go -v TestUnit |
| 62 | + shell: bash |
| 63 | + |
| 64 | + VetLint: |
| 65 | + name: Vet and Lint |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: checkout |
| 69 | + uses: actions/checkout@v3.5.0 |
| 70 | + - uses: actions/setup-go@v4 |
| 71 | + with: |
| 72 | + go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. |
| 73 | + - run: go version |
| 74 | + - name: Vet |
| 75 | + run: go run mage.go Vet |
| 76 | + shell: bash |
| 77 | + - name: Lint |
| 78 | + run: go run mage.go Lint |
| 79 | + shell: bash |
| 80 | + |
| 81 | + Build-docker-images: |
| 82 | + name: Build Docker Images |
| 83 | + needs: |
| 84 | + - XBuild |
| 85 | + runs-on: ubuntu-latest |
| 86 | + if: success() |
| 87 | + steps: |
| 88 | + - name: checkout |
| 89 | + uses: actions/checkout@v3.5.0 |
| 90 | + - uses: actions/setup-go@v4 |
| 91 | + with: |
| 92 | + go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. |
| 93 | + - run: go version |
| 94 | + - name: Download Cross-Compiled Porter Binaries |
| 95 | + uses: actions/download-artifact@v3.0.1 |
| 96 | + with: |
| 97 | + name: xbuild-bin |
| 98 | + path: bin |
| 99 | + - name: Setup Bin |
| 100 | + run: go run mage.go UseXBuildBinaries |
| 101 | + - name: Build Docker Images |
| 102 | + run: go run mage.go BuildImages |
| 103 | + |
| 104 | + Smoke-test: |
| 105 | + name: Smoke Test |
| 106 | + needs: |
| 107 | + - XBuild |
| 108 | + runs-on: ubuntu-latest |
| 109 | + steps: |
| 110 | + - name: checkout |
| 111 | + uses: actions/checkout@v3.5.0 |
| 112 | + - name: Download Cross-Compiled Porter Binaries |
| 113 | + uses: actions/download-artifact@v3.0.1 |
| 114 | + with: |
| 115 | + name: xbuild-bin |
| 116 | + path: bin |
| 117 | + - uses: actions/setup-go@v4 |
| 118 | + with: |
| 119 | + go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. |
| 120 | + - run: go version |
| 121 | + - name: Setup Bin |
| 122 | + run: go run mage.go UseXBuildBinaries |
| 123 | + - name: Run Smoke Tests |
| 124 | + run: go run mage.go -v TestSmoke |
0 commit comments