antonmarin/secret-yaml

View on GitHub
.github/workflows/onpush.yml

Summary

Maintainability
Test Coverage
name: pipeline
on: [push]
jobs:
  test:
    name: Integration pipeline
    runs-on: ubuntu-22.04
    steps:
      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: '1.19'
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup
        run: |
          export PATH=$PATH:/tmp;
          wget -qO - "https://github.com/go-task/task/releases/download/v2.2.1/task_linux_amd64.tar.gz" | tar zxf - -C /tmp task;
          ls -la /tmp/task;
          task --version;
          wget -qO - https://codeclimate.com/downloads/test-reporter/test-reporter-0.10.4-linux-amd64 > /tmp/cc-test-reporter;
          chmod +x /tmp/cc-test-reporter;
          ls -la /tmp/cc-test-reporter;
          cc-test-reporter -v;
      - name: Test
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
        run: |
          export PATH=$PATH:/tmp;
          cc-test-reporter before-build;
          task test;
          cc-test-reporter after-build -t gocov --exit-code $? -p github.com/antonmarin/secret-yaml;
      - name: Report coverage
        env:
          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          go install github.com/mattn/goveralls@latest;
          goveralls -coverprofile=c.out -service=github;
  release:
    name: Release app
    if: startsWith(github.ref, 'refs/tags/')
    needs:
      - test
    strategy:
      matrix:
        include:
          - goos: linux
            os: ubuntu-22.04
          - goos: darwin
            os: macos-12
    runs-on: ${{ matrix.os }}
    steps:
      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: '1.19'
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup
        run: |
          export PATH=$PATH:/tmp;
          wget -qO - "https://github.com/go-task/task/releases/download/v2.2.1/task_${{ matrix.goos }}_amd64.tar.gz" | tar zxf - -C /tmp task;
          ls -la /tmp/task;
          task --version;
      - name: Build binary files
        run: |
          export PATH=$PATH:/tmp;
          BINARY_PATH="release/syml" CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=amd64 task compile;
          ls release/;
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          files: release/syml-${{ matrix.goos }}
          draft: true