-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (71 loc) · 2.75 KB
/
Copy pathci.yml
File metadata and controls
83 lines (71 loc) · 2.75 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
name: CI
on: { pull_request: { } }
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build-container:
runs-on: ubuntu-latest
permissions:
security-events: write
packages: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Build container
uses: infrabits/ci-pack@c72247fc9ba1598090115c1d099e5c779b8bc79c # main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/${{ github.repository }}:${{ github.sha }}
use_builder: latest
buildpack: https://github.com/InfraBits/cmake-buildpack/releases/download/v1.0.1/buildpack.tar.gz
test-container:
runs-on: ubuntu-latest
needs: [build-container]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Start container
run: |
docker pull ghcr.io/${{ github.repository }}:${{ github.sha }}
docker run -d -p 3565:3565 ghcr.io/${{ github.repository }}:${{ github.sha }}
timeout 30 bash -c 'until nc -w 1 127.0.0.1 3565 2>/dev/null | grep -q "<WPEditSet>"; do sleep 1; done'
- name: Verify a vandalised edit
run: |
result=$(nc -q 10 127.0.0.1 3565 < .github/data/bad_edit.xml)
echo "${result}"
echo "${result}" | grep -q '<think_vandalism>true</think_vandalism>'
- name: Verify a clean edit
run: |
result=$(nc -q 10 127.0.0.1 3565 < .github/data/good_edit.xml)
echo "${result}"
echo "${result}" | grep -q '<think_vandalism>false</think_vandalism>'
package-artifacts:
runs-on: ubuntu-latest
needs: [build-container, test-container]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Extract artifacts
run: |
mkdir -p release/{bin,data}
docker pull ghcr.io/${{ github.repository }}:${{ github.sha }}
cid=$(docker create ghcr.io/${{ github.repository }}:${{ github.sha }})
# Binaries
for obj in cluebotng create_ann create_bayes_db print_bayes_db;
do
docker cp "${cid}:/workspace/${obj}" release/bin/${obj}
done
# Databases
for obj in main_ann.fann bayes.db two_bayes.db;
do
docker cp "${cid}:/workspace/data/${obj}" release/data/${obj}
done
docker rm "${cid}"
# Config files
tar -czf release/conf.tar.gz conf
- name: Stash the artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: release-artifacts
retention-days: 7
path: |
release/**