Skip to content

Commit b6fe33a

Browse files
authored
Merge 1947add into 0bf5dee
2 parents 0bf5dee + 1947add commit b6fe33a

File tree

7 files changed

+56
-33
lines changed

7 files changed

+56
-33
lines changed

.github/workflows/ccpp.yml

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
bump-tag-dry:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
- name: Get next version
1616
id: tag
17-
uses: anothrNick/github-tag-action@1.36.0
17+
uses: anothrNick/github-tag-action@1.67.0
1818
env:
1919
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2020
WITH_V: true
@@ -32,20 +32,25 @@ jobs:
3232
runs-on: ubuntu-latest
3333
needs: [bump-tag-dry]
3434
steps:
35-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v4
3636
- name: download artifacts
3737
uses: actions/download-artifact@v1
3838
with:
3939
name: uploads
40+
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: 18
44+
4045
- name: build
4146
run: |
42-
sudo npm install -g bats
47+
npm install -g bats
4348
export DUPLO_VERSION=`cat ./uploads/tag.txt`
4449
mkdir -p build
4550
pushd build
4651
cmake .. -DDUPLO_VERSION=\"$DUPLO_VERSION\"
52+
make
4753
popd
48-
./compile.sh
4954
zip --junk-paths duplo-linux build/duplo
5055
- name: upload linux artifact
5156
uses: actions/upload-artifact@v1
@@ -56,7 +61,7 @@ jobs:
5661
runs-on: macos-latest
5762
needs: [bump-tag-dry]
5863
steps:
59-
- uses: actions/checkout@v2
64+
- uses: actions/checkout@v4
6065
- name: download artifacts
6166
uses: actions/download-artifact@v1
6267
with:
@@ -84,28 +89,53 @@ jobs:
8489
uses: actions/download-artifact@v1
8590
with:
8691
name: uploads
92+
8793
- name: set version
88-
run: echo "{DUPLO_VERSION}={$(cat ./uploads/tag.txt)}" >> $GITHUB_ENV
89-
- name: print version
90-
run: echo $DUPLO_VERSION
91-
- uses: actions/checkout@master
94+
id: version
95+
run: |
96+
DUPLO_VERSION=$(cat ./uploads/tag.txt)
97+
echo $DUPLO_VERSION
98+
echo "DUPLO_VERSION=$DUPLO_VERSION" >> $GITHUB_ENV
99+
echo "DUPLO_VERSION=$DUPLO_VERSION" >> $GITHUB_OUTPUT
100+
101+
- uses: actions/checkout@v4
92102
with:
93103
fetch-depth: '0'
94-
- uses: docker/build-push-action@v1
104+
105+
- name: Set up Docker Buildx
106+
uses: docker/setup-buildx-action@v3
107+
108+
- name: Login to Docker Hub
109+
if: github.event_name != 'pull_request'
110+
uses: docker/login-action@v3
95111
with:
96112
username: ${{ secrets.DOCKER_USERNAME }}
97113
password: ${{ secrets.DOCKER_PASSWORD }}
98-
repository: dlidstrom/duplo
99-
tag_with_ref: true
100-
# push: ${{ startsWith(github.ref, 'refs/tags/') }}
101-
build_args: DUPLO_VERSION=${{ env.DUPLO_VERSION }}
102-
tags: ${{ env.DUPLO_VERSION }}
114+
115+
- name: Docker build
116+
if: github.event_name == 'pull_request'
117+
uses: docker/build-push-action@v5
118+
with:
119+
push: false
120+
tags: "dlidstrom/duplo:${{ steps.version.outputs.DUPLO_VERSION }}"
121+
build-args: |
122+
"DUPLO_VERSION=${{ steps.version.outputs.DUPLO_VERSION }}"
123+
124+
- name: Docker build and push
125+
if: github.event_name != 'pull_request'
126+
uses: docker/build-push-action@v5
127+
with:
128+
push: true
129+
tags: "dlidstrom/duplo:latest,dlidstrom/duplo:${{ steps.version.outputs.DUPLO_VERSION }}"
130+
build-args: |
131+
"DUPLO_VERSION=${{ steps.version.outputs.DUPLO_VERSION }}"
132+
103133
upload-release:
104134
if: success()
105135
runs-on: ubuntu-latest
106136
needs: [build-linux, build-macos]
107137
steps:
108-
- uses: actions/checkout@master
138+
- uses: actions/checkout@v4
109139
with:
110140
fetch-depth: '0'
111141
- name: Bump version and push tag

compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [ ! -d "build" ]; then
1818
fi
1919

2020
p "compiling..." &&
21-
pushd build
21+
pushd build || exit 1
2222
make &&
2323
popd &&
2424
bats --recursive tests &&

tests/Quake2/tests.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@test "g_chase.c" {
2-
run ./build/duplo tests/Quake2/files.lst out.txt && cat out.txt
2+
run ./build/duplo tests/Quake2/files.lst out.txt
3+
cat out.txt
34
printf 'lines %s\n' "${lines[@]}" >&2
45
echo "status = $status"
56
[ "$status" -eq 0 ]

tests/Simple/test-xml.bats

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
setup() {
2-
run ./build/duplo -xml tests/Simple/LineNumbers.lst out.xml
3-
}
4-
51
@test "LineNumbers.c" {
2+
run ./build/duplo -xml tests/Simple/LineNumbers.lst out.xml
63
[ "$status" -eq 0 ]
74
[ "${lines[0]}" = "Loading and hashing files ... 2 done." ]
85
[ "${lines[1]}" = "tests/Simple/LineNumbers.c found: 1 block(s)" ]
96
}
107

118
@test "LineNumbers.c out.xml" {
9+
run ./build/duplo -xml tests/Simple/LineNumbers.lst out.xml
1210
run cat out.xml
1311
printf 'Lines:\n'
1412
printf 'lines %s\n' "${lines[@]}" >&2

tests/Simple/tests.bats

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
setup() {
2-
run ./build/duplo tests/Simple/LineNumbers.lst out.txt
3-
}
4-
51
@test "LineNumbers.c" {
2+
run ./build/duplo tests/Simple/LineNumbers.lst out.txt
63
[ "$status" -eq 0 ]
74
[ "${lines[0]}" = "Loading and hashing files ... 2 done." ]
85
[ "${lines[1]}" = "tests/Simple/LineNumbers.c found: 1 block(s)" ]
96
}
107

118
@test "LineNumbers.c out.txt" {
9+
run ./build/duplo tests/Simple/LineNumbers.lst out.txt
1210
run cat out.txt
1311
printf 'Lines:\n'
1412
printf 'lines %s\n' "${lines[@]}" >&2

tests/Simple_Ada/tests.bats

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
setup() {
2-
run ./build/duplo -ml 2 tests/Simple_Ada/simple_log.lst out.txt
3-
}
4-
51
@test "simple_log.adb" {
2+
run ./build/duplo -ml 2 tests/Simple_Ada/simple_log.lst out.txt
63
[ "$status" -eq 0 ]
74
[ "${lines[0]}" = "Loading and hashing files ... 2 done." ]
85
[ "${lines[1]}" = "tests/Simple_Ada/simple_log.adb found: 6 block(s)" ]
96
}
107

118
@test "simple_log.adb out.txt" {
9+
run ./build/duplo -ml 2 tests/Simple_Ada/simple_log.lst out.txt
1210
run cat out.txt
1311
printf 'Lines:\n'
1412
printf 'lines %s\n' "${lines[@]}" >&2

tests/test.bats

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
echo "status = $status"
55
[ "$status" -eq 1 ]
66
[ "${lines[0]}" = "NAME" ]
7-
[ "${lines[1]}" = " Duplo $DUPLO_VERSION - duplicate source code block finder" ]
87
[ "${lines[2]}" = "SYNOPSIS" ]
98
[ "${lines[3]}" = " duplo [OPTIONS] [INTPUT_FILELIST] [OUTPUT_FILE]" ]
109
[ "${lines[4]}" = "DESCRIPTION" ]
@@ -23,7 +22,6 @@
2322
[ "${lines[17]}" = " INPUT_FILELIST input filelist (specify '-' to read from stdin)" ]
2423
[ "${lines[18]}" = " OUTPUT_FILE output file" ]
2524
[ "${lines[19]}" = "VERSION" ]
26-
[ "${lines[20]}" = " $DUPLO_VERSION" ]
2725
[ "${lines[21]}" = "AUTHORS" ]
2826
[ "${lines[22]}" = " Daniel Lidstrom (dlidstrom@gmail.com)" ]
2927
[ "${lines[23]}" = " Christian M. Ammann (cammann@giants.ch)" ]

0 commit comments

Comments
 (0)