|
1 |
| -name: ci |
| 1 | +name: ci-release |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: # Run on push to any branch |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
5 | 7 |
|
6 | 8 | jobs:
|
7 |
| - test-ubuntu: |
8 |
| - name: Tests (Ubuntu) |
9 |
| - runs-on: ubuntu-latest |
10 |
| - steps: |
11 |
| - - name: Checkout code |
12 |
| - uses: actions/checkout@v4 |
13 |
| - - name: Set up Go |
14 |
| - uses: actions/setup-go@v5 |
15 |
| - with: |
16 |
| - go-version: stable |
17 |
| - |
18 |
| - - name: Install deps |
19 |
| - run: | |
20 |
| - sudo apt install -y libx11-dev |
21 |
| -
|
22 |
| - - name: Run tests |
23 |
| - run: make test |
24 |
| - |
25 |
| - test-freebsd: |
26 |
| - name: Tests (FreeBSD) |
27 |
| - # Sadly GitHub doesn't support FreeBSD runners natively, so we |
28 |
| - # run Ubuntu and then start FreeBSD VM. |
29 |
| - # See https://github.com/vmactions/freebsd-vm |
30 |
| - runs-on: ubuntu-latest |
31 |
| - steps: |
32 |
| - - name: Checkout code |
33 |
| - uses: actions/checkout@v4 |
34 |
| - |
35 |
| - - name: Run tests in FreeBSD VM |
36 |
| - uses: vmactions/freebsd-vm@v1 |
37 |
| - with: |
38 |
| - usesh: true |
39 |
| - prepare: | |
40 |
| - pkg install -y go git bash gawk tmux |
41 |
| -
|
42 |
| - run: | |
43 |
| - # Without it, git doesn't like to work with this repo: |
44 |
| - # fatal: detected dubious ownership in repository at '....' |
45 |
| - # So here we work it around by marking the directory as safe. |
46 |
| - git config --global --add safe.directory "${PWD}" |
47 |
| -
|
48 |
| - make test |
49 |
| -
|
50 |
| - test-macos: |
51 |
| - name: Tests (MacOS) |
52 |
| - runs-on: macos-latest |
53 |
| - steps: |
54 |
| - - name: Checkout code |
55 |
| - uses: actions/checkout@v4 |
56 |
| - - name: Set up Go |
57 |
| - uses: actions/setup-go@v5 |
58 |
| - with: |
59 |
| - go-version: stable |
60 |
| - |
61 |
| - - name: Install deps |
62 |
| - run: | |
63 |
| - brew update |
64 |
| - brew install gawk tmux |
65 |
| -
|
66 |
| - - name: Run tests |
67 |
| - run: make test |
68 |
| - |
69 |
| - test-ubuntu-ssh: |
70 |
| - name: Core tests via SSH |
71 |
| - runs-on: ubuntu-latest |
72 |
| - steps: |
73 |
| - - name: Checkout code |
74 |
| - uses: actions/checkout@v4 |
75 |
| - |
76 |
| - # NOTE: we do NOT use the actions/setup-go@v5 here and just use the |
77 |
| - # Go version installed by default, because otherwise this newly installed |
78 |
| - # Go version is only available in the local session, but not available |
79 |
| - # over ssh, which causes the build cache not to be reused, which renders |
80 |
| - # our trick to prebuild the journalctl_mock useless (see in Makefile: |
81 |
| - # cd cmd/journalctl_mock && go build -o /dev/null ), which causes the mock |
82 |
| - # build to take too long, which causes the tests to time out and fail. |
83 |
| - |
84 |
| - - name: Install deps |
85 |
| - run: | |
86 |
| - sudo apt install -y libx11-dev |
87 |
| -
|
88 |
| - - name: Set up ssh server |
89 |
| - run: | |
90 |
| - sudo systemctl start ssh |
91 |
| - sudo systemctl status ssh |
92 |
| -
|
93 |
| - # Set up the ssh key to be able to ssh 127.0.0.1 without password |
94 |
| - mkdir -p ~/.ssh |
95 |
| - ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa |
96 |
| - cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys |
97 |
| - chmod 600 ~/.ssh/authorized_keys |
98 |
| - chmod 700 ~/.ssh |
99 |
| - ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts |
100 |
| -
|
101 |
| - # Test it |
102 |
| - goroot_local="$(go env GOROOT)" |
103 |
| - goroot_ssh="$(ssh 127.0.0.1 'go env GOROOT')" |
104 |
| - echo "GOROOT local: $goroot_local" |
105 |
| - echo "GOROOT ssh: $goroot_ssh" |
106 |
| - if [[ "$goroot_local" != "$goroot_ssh" ]]; then |
107 |
| - echo Error: GOROOT are different, it might cause issues |
108 |
| - exit 1 |
109 |
| - else |
110 |
| - echo GOROOT are the same both locally and over ssh, all good |
111 |
| - fi |
112 |
| -
|
113 |
| - - name: Run core tests using ssh transport |
114 |
| - run: | |
115 |
| - # Add the key to agent, since that's what Nerdlog uses |
116 |
| - eval "$(ssh-agent -s)" |
117 |
| - ssh-add ~/.ssh/id_rsa |
118 |
| -
|
119 |
| - NERDLOG_CORE_TEST_HOSTNAME='127.0.0.1' make test ARGS='-run TestCoreScenarios' |
120 |
| -
|
121 | 9 | release-please:
|
122 |
| - if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
123 | 10 | runs-on: ubuntu-latest
|
124 | 11 | outputs:
|
125 | 12 | releases_created: ${{ steps.release-please.outputs.releases_created }}
|
|
0 commit comments