Files
systemctl/.github/workflows/ci.yml
Tai Groot 2f04c28cc1 chore: update Go 1.26.2, document all helpers in README, use prepareArgs consistently (#12)
- Bump go.mod from 1.26.1 to 1.26.2
- Add all helper functions to README (GetUnits, GetMaskedUnits,
  GetSocketsForServiceUnit, IsSystemd, IsMasked, IsRunning,
  HasValidUnitSuffix)
- Remove unused fmt import from README example
- Refactor GetSocketsForServiceUnit, GetUnits, GetMaskedUnits to use
  prepareArgs instead of manual arg construction
- Add Go 1.26.2 to CI test matrix
2026-04-12 10:27:36 +02:00

66 lines
1.5 KiB
YAML

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
test:
name: Test (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.26", "1.26.2"]
steps:
- uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Install and start nginx
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq nginx
sudo systemctl start nginx
sudo systemctl enable nginx
- name: Run tests (user)
run: go test -race -coverprofile=coverage-user.out -covermode=atomic ./...
- name: Run tests (root)
run: sudo go test -race -coverprofile=coverage-root.out -covermode=atomic ./...
- name: Upload coverage to Codecov
if: matrix.go-version == '1.26.2'
uses: codecov/codecov-action@v5
with:
files: coverage-user.out,coverage-root.out
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
cache: true
- name: Run staticcheck
uses: dominikh/staticcheck-action@v1
with:
version: latest
install-go: false