github.com/kubecost/golang-migrate-duckdb/v4@v4.17.0-duckdb.1/.github/workflows/ci.yaml (about)

     1  name: CI
     2  
     3  on:
     4    push:
     5    pull_request:
     6  
     7  jobs:
     8    lint:
     9      name: lint
    10      runs-on: ubuntu-latest
    11      steps:
    12        - uses: actions/setup-go@v3
    13          with:
    14            go-version: "1.20.x"
    15        - uses: actions/checkout@v3
    16        - name: golangci-lint
    17          uses: golangci/golangci-lint-action@v3
    18          with:
    19            version: latest
    20  
    21    test:
    22      runs-on: ubuntu-latest
    23      strategy:
    24        matrix:
    25          go: ["1.19.x", "1.20.x"]
    26      steps:
    27        - uses: actions/checkout@v3
    28  
    29        - uses: actions/setup-go@v3
    30          with:
    31            go-version: ${{ matrix.go }}
    32  
    33        - name: Run test
    34          run: make test COVERAGE_DIR=/tmp/coverage
    35  
    36    goreleaser:
    37      name: Release a new version
    38      needs: [lint, test]
    39      runs-on: ubuntu-latest
    40      environment: GoReleaser
    41      # This job only runs when
    42      # 1. When the previous `lint` and `test` jobs has completed successfully
    43      # 2. When the repository is not a fork, i.e. it will only run on the official golang-migrate/migrate
    44      # 3. When the workflow is triggered by a tag with `v` prefix
    45      if: ${{ success() && github.repository == 'golang-migrate/migrate' && startsWith(github.ref, 'refs/tags/v') }}
    46      steps:
    47        - uses: actions/checkout@v3
    48          with:
    49            fetch-depth: 0
    50        - uses: ruby/setup-ruby@v1
    51          with:
    52            ruby-version: 2.7
    53        - uses: actions/setup-go@v3
    54          with:
    55            go-version: "1.19.x"
    56  
    57        - uses: docker/setup-qemu-action@v1
    58        - uses: docker/setup-buildx-action@v1
    59        - uses: docker/login-action@v1
    60          with:
    61            username: golangmigrate
    62            password: ${{ secrets.DOCKERHUB_TOKEN }}
    63  
    64        - run: echo "SOURCE=$(make echo-source)" >> $GITHUB_ENV
    65        - run: echo "DATABASE=$(make echo-database)" >> $GITHUB_ENV
    66  
    67        - uses: goreleaser/goreleaser-action@v2
    68          with:
    69            version: latest
    70            args: release --rm-dist
    71          env:
    72            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    73  
    74        - run: gem install package_cloud
    75        - run: package_cloud push golang-migrate/migrate/ubuntu/bionic dist/migrate.linux-amd64.deb
    76          env:
    77            PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
    78        - run: package_cloud push golang-migrate/migrate/ubuntu/focal dist/migrate.linux-amd64.deb
    79          env:
    80            PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
    81        - run: package_cloud push golang-migrate/migrate/ubuntu/jammy dist/migrate.linux-amd64.deb
    82          env:
    83            PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
    84        - run: package_cloud push golang-migrate/migrate/debian/buster dist/migrate.linux-amd64.deb
    85          env:
    86            PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
    87        - run: package_cloud push golang-migrate/migrate/debian/bullseye dist/migrate.linux-amd64.deb
    88          env:
    89            PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
    90        - run: package_cloud push golang-migrate/migrate/debian/bookworm dist/migrate.linux-amd64.deb
    91          env:
    92            PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}