-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (81 loc) · 2.61 KB
/
Copy pathci.yml
File metadata and controls
84 lines (81 loc) · 2.61 KB
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
name: CI
on:
push:
branches:
- master
- main
pull_request:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
test-push:
name: Go test
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Tor
run: |
sudo apt-get install -y tor
- name: Start Tor
run: |
sudo systemctl start tor --now
- name: Setup Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests with testhooks
run: nix develop --command go test ./... -tags="compattest testhooks" -coverprofile=coverage.out -coverpkg=./...
- name: Filter internal test files from coverage
run: ./scripts/filter_coverage.sh coverage.out coverage.out
- name: Send coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: "nix develop --command coveralls report coverage.out"
typos:
name: Check for typos
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix develop --command typos --exclude .golangci.yml
commitizen-pr:
name: Lint git commits
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# ensure we check the PR branch tip rather than the auto-created merge ref
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Check all commits in PR
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
# ensure the base branch ref exists locally
git fetch origin "$BASE_REF":"$BASE_REF" || true
BASE_MERGE=$(git merge-base origin/${BASE_REF} HEAD)
nix develop --command cz check --rev-range "${BASE_MERGE}..HEAD"
test-pr:
name: Go test
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix develop --command go test ./... -tags="compattest testhooks"