File: builds

package info (click to toggle)
golang-github-charmbracelet-x 0.0~git20251028.0cf22f8%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,940 kB
  • sloc: sh: 124; makefile: 5
file content (100 lines) | stat: -rwxr-xr-x 2,534 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash

# shellcheck disable=SC2016
find . -type f -name go.mod | sort | while read -r mod; do
  dir="$(dirname "$mod")"
  name="$(basename "$dir")"
  # get the parent directory when the module is nested semver-style
  if [[ "$name" =~ ^v[0-9]+.*$ ]]; then
    ver="$(basename "$dir")"
    dir="$(dirname "$dir")"
    name="$(basename "$dir")-$ver"
  fi

  sum="$dir/go.sum"
  echo "# auto-generated by scripts/builds. DO NOT EDIT.
name: $name

on:
  push:
    branches:
      - main
  pull_request:
    paths:
      - $(dirname "$mod" | cut -f2- -d/)/**
      - .github/workflows/${name}.yml

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: \${{ matrix.os }}
    defaults:
      run:
        working-directory: $(dirname "$mod")
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-go@v6
        with:
          go-version-file: $mod
          cache: true
          cache-dependency-path: $sum
      - run: go build -v ./...
      - run: go test -race -v ./...

  dependabot:
    needs: [build]
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      contents: write
    if: \${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
    steps:
      - id: metadata
        uses: dependabot/fetch-metadata@v2
        with:
          github-token: \"\${{ secrets.GITHUB_TOKEN }}\"
      - run: |
          gh pr review --approve \"\$PR_URL\"
          gh pr merge --squash --auto \"\$PR_URL\"
        env:
          PR_URL: \${{github.event.pull_request.html_url}}
          GITHUB_TOKEN: \${{secrets.GITHUB_TOKEN}}

  lint:
    uses: charmbracelet/meta/.github/workflows/lint.yml@main
    with:
      directory: $(dirname "$mod" | cut -f2- -d/)

  coverage:
    strategy:
      matrix:
        go-version: [^1]
        os: [ubuntu-latest, windows-latest, macos-latest]
    defaults:
      run:
        working-directory: $(dirname "$mod")
    runs-on: \${{ matrix.os }}
    env:
      GO111MODULE: \"on\"
    steps:
      - name: Install Go
        uses: actions/setup-go@v6
        with:
          go-version: \${{ matrix.go-version }}

      - name: Checkout code
        uses: actions/checkout@v5

      - name: Coverage
        run: |
          go test -race -covermode=atomic -coverprofile='coverage.txt' ./...

      - uses: codecov/codecov-action@v5
        with:
          file: ./coverage.txt
          token: \${{ secrets.CODECOV_TOKEN }}

" >"./.github/workflows/${name}.yml"
done