|
1 | | -name: CICD |
| 1 | +name: Test and Lint |
| 2 | + |
2 | 3 | on: |
3 | 4 | pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + |
4 | 9 | jobs: |
5 | | - Describe: |
| 10 | + lint: |
6 | 11 | runs-on: ubuntu-latest |
7 | 12 | steps: |
8 | | - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." |
9 | | - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" |
10 | | - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." |
11 | | - - name: Check out repository code |
12 | | - uses: actions/checkout@v3 |
13 | | - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." |
14 | | - - run: echo "🖥️ The workflow is now ready to test your code on the runner." |
15 | | - - name: List files in the repository |
16 | | - run: | |
17 | | - ls ${{ github.workspace }} |
18 | | - - run: echo "🍏 This job's status is ${{ job.status }}." |
19 | | - test-unix: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - uses: actions/setup-go@v5 |
| 15 | + with: |
| 16 | + go-version: "1.23" |
| 17 | + cache: true |
| 18 | + - name: Install Task |
| 19 | + uses: arduino/setup-task@v2 |
| 20 | + - name: Run lint |
| 21 | + run: task lint |
| 22 | + |
| 23 | + test: |
20 | 24 | strategy: |
21 | 25 | fail-fast: false |
22 | 26 | matrix: |
23 | | - platform: |
24 | | - - ubuntu |
25 | | - - macOS |
26 | | - go: |
27 | | - - 21 |
28 | | - name: '${{ matrix.platform }} | 1.${{ matrix.go }}.x' |
29 | | - runs-on: ${{ matrix.platform }}-latest |
| 27 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 28 | + go: ["1.21", "1.22", "1.23"] |
| 29 | + name: "${{ matrix.os }} | ${{ matrix.go }}" |
| 30 | + runs-on: ${{ matrix.os }} |
30 | 31 | steps: |
31 | | - - uses: actions/checkout@v3 |
32 | | - - uses: actions/setup-go@v3 |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - uses: actions/setup-go@v5 |
33 | 34 | with: |
34 | | - go-version: 1.${{ matrix.go }}.x |
| 35 | + go-version: ${{ matrix.go }} |
35 | 36 | cache: true |
36 | | - - run: | |
37 | | - export GOBIN=$HOME/go/bin |
38 | | - case "${{ matrix.go }}" in |
39 | | - 14|15) _version='';; |
40 | | - *) _version='@latest';; |
41 | | - esac |
42 | | - go install github.com/kyoh86/richgo"${_version}" |
43 | | - go install github.com/mitchellh/gox"${_version}" |
44 | | - - run: RICHGO_FORCE_COLOR=1 PATH=$HOME/go/bin/:$PATH make test |
| 37 | + - name: Install Task |
| 38 | + uses: arduino/setup-task@v2 |
| 39 | + - name: Run tests |
| 40 | + run: task test |
0 commit comments