|
| 1 | +name: Main |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + main: |
| 12 | + name: Main Process |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + GO_VERSION: 1.19 |
| 16 | + GOLANGCI_LINT_VERSION: v1.50.0 |
| 17 | + YAEGI_VERSION: v0.14.2 |
| 18 | + CGO_ENABLED: 0 |
| 19 | + defaults: |
| 20 | + run: |
| 21 | + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} |
| 22 | + |
| 23 | + steps: |
| 24 | + |
| 25 | + # https://github.com/marketplace/actions/setup-go-environment |
| 26 | + - name: Set up Go ${{ env.GO_VERSION }} |
| 27 | + uses: actions/setup-go@v2 |
| 28 | + with: |
| 29 | + go-version: ${{ env.GO_VERSION }} |
| 30 | + |
| 31 | + # https://github.com/marketplace/actions/checkout |
| 32 | + - name: Check out code |
| 33 | + uses: actions/checkout@v2 |
| 34 | + with: |
| 35 | + path: go/src/github.com/${{ github.repository }} |
| 36 | + fetch-depth: 0 |
| 37 | + |
| 38 | + # https://github.com/marketplace/actions/cache |
| 39 | + - name: Cache Go modules |
| 40 | + uses: actions/cache@v3 |
| 41 | + with: |
| 42 | + path: ${{ github.workspace }}/go/pkg/mod |
| 43 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-go- |
| 46 | +
|
| 47 | + # https://golangci-lint.run/usage/install#other-ci |
| 48 | + - name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} |
| 49 | + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} |
| 50 | + |
| 51 | + - name: Install Yaegi ${{ env.YAEGI_VERSION }} |
| 52 | + run: curl -sfL https://raw.githubusercontent.com/traefik/yaegi/master/install.sh | bash -s -- -b $(go env GOPATH)/bin ${YAEGI_VERSION} |
| 53 | + |
| 54 | + - name: Setup GOPATH |
| 55 | + run: go env -w GOPATH=${{ github.workspace }}/go |
| 56 | + |
| 57 | + - name: Check and get dependencies |
| 58 | + run: | |
| 59 | + go mod tidy |
| 60 | + git diff --exit-code go.mod |
| 61 | + # git diff --exit-code go.sum |
| 62 | + go mod download |
| 63 | + go mod vendor |
| 64 | + # git diff --exit-code ./vendor/ |
| 65 | +
|
| 66 | + - name: Lint and Tests |
| 67 | + run: make |
| 68 | + |
| 69 | + - name: Run tests with Yaegi |
| 70 | + run: make yaegi_test |
| 71 | + env: |
| 72 | + GOPATH: ${{ github.workspace }}/go |
0 commit comments