-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (149 loc) · 5.13 KB
/
ci.yml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
on:
push:
branches: [ main ]
tags: [ v* ]
repository_dispatch:
types: [ new-jx ]
workflow_dispatch:
jobs:
analyze-ubuntu:
name: "Ubuntu: Analyze"
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
env:
BUILD_WRAPPER_OUT_DIR: sonar_output
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set environment variables
run: |
echo SONAR_CACHE_PATH=$HOME/$BUILD_WRAPPER_OUT_DIR >> $GITHUB_ENV
echo FORCE_CACHE_UPDATE=${RANDOM}${RANDOM} >> $GITHUB_ENV
- name: Sonar data cache
uses: actions/cache@v4
with:
path: ${{ env.SONAR_CACHE_PATH }}
key: ${{ runner.os }}-sonar-cache-${{ env.FORCE_CACHE_UPDATE }}
restore-keys: |
${{ runner.os }}-sonar-cache-
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp
- name: Configure
run: ./configure ci
- name: Build
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make all
- name: Run tests
continue-on-error: true
run: |
make test || true
cd code_crusader/test
make reset
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
build-ubuntu:
name: Ubuntu
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: jafl/jx_application_framework/.github/workflows/app-build-ubuntu.yml@main
with:
pkg-name: code-*
build-cmd: make all
build-fedora:
name: Fedora
uses: jafl/jx_application_framework/.github/workflows/app-build-fedora.yml@main
with:
pkg-name: code-*
build-cmd: make all
build-macos:
name: macOS
uses: jafl/jx_application_framework/.github/workflows/app-build-macos.yml@main
with:
pkg-name: code-*
build-cmd: make all
release:
name: Upload releases
runs-on: ubuntu-latest
needs: [ build-ubuntu, build-fedora, build-macos ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/download-artifact@v4
with:
name: release
- name: Save release packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: code-*.*
file_glob: true
update-sourceforge-code-crusader:
name: Crusader
needs: [ release ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: jafl/jx_application_framework/.github/workflows/app-mirror-sourceforge.yml@main
with:
forge-name: codecrusader
filter: code-crusader*
secrets:
api-key: ${{ secrets.SOURCEFORGE_API_KEY }}
ssh-key: ${{ secrets.SOURCEFORGE_SSH_KEY }}
update-sourceforge-code-medic:
name: Medic
needs: [ release ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: jafl/jx_application_framework/.github/workflows/app-mirror-sourceforge.yml@main
with:
forge-name: codemedic
filter: code-medic*
secrets:
api-key: ${{ secrets.SOURCEFORGE_API_KEY }}
ssh-key: ${{ secrets.SOURCEFORGE_SSH_KEY }}
update-sourceforge-code-mill:
name: Mill
needs: [ release ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: jafl/jx_application_framework/.github/workflows/app-mirror-sourceforge.yml@main
with:
forge-name: nps-codemill
filter: code-mill*
secrets:
api-key: ${{ secrets.SOURCEFORGE_API_KEY }}
ssh-key: ${{ secrets.SOURCEFORGE_SSH_KEY }}
publish-version:
name: Publish version
runs-on: ubuntu-latest
needs: [ update-sourceforge-code-crusader, update-sourceforge-code-medic, update-sourceforge-code-mill ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update version & docs
run: |
echo "${{ secrets.SOURCEFORGE_SSH_KEY }}" > ssh-key
chmod 0600 ssh-key
scp -o StrictHostKeyChecking=no -i ssh-key code_crusader/release/VERSION code_crusader/release/doc/* jafl,codecrusader@web.sourceforge.net:htdocs/;
scp -o StrictHostKeyChecking=no -i ssh-key code_medic/release/VERSION code_medic/release/doc/* jafl,codemedic@web.sourceforge.net:htdocs/;
scp -o StrictHostKeyChecking=no -i ssh-key code_mill/release/VERSION code_mill/release/doc/* jafl,nps-codemill@web.sourceforge.net:htdocs/;
update-homebrew:
name: Update Homebrew Formulas
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.UPDATE_HOMEBREW }}
repository: jafl/homebrew-jx
event-type: new-release