Skip to content

Commit b4d6417

Browse files
authored
Add deploy steps (#2)
* Add deploy steps * Add devcontainer
1 parent 1a928c5 commit b4d6417

24 files changed

Lines changed: 343 additions & 198 deletions

.devcontainer/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ARG DOCKER_OS=debian:bookworm
2+
3+
FROM $DOCKER_OS
4+
5+
COPY scripts/container.setup.sh /tmp/container.setup.sh
6+
7+
RUN --mount=type=cache,target=/var/cache/apt <<EOS
8+
/tmp/container.setup.sh
9+
EOS

.devcontainer/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
3+
{
4+
"name": "FileOp",
5+
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
6+
"postCreateCommand": "sudo ./scripts/container.setup.sh",
7+
"customizations": {
8+
"vscode": {
9+
// cspell:disable
10+
"extensions": [
11+
"seunlanlege.action-buttons",
12+
"streetsidesoftware.code-spell-checker",
13+
"ms-vscode.cpptools"
14+
]
15+
// cspell:enable
16+
}
17+
}
18+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
19+
// "forwardPorts": [],
20+
// Configure tool-specific properties.
21+
// "customizations": {},
22+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
23+
// "remoteUser": "root"
24+
}

.github/workflows/CI.yml

Lines changed: 78 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,16 @@ jobs:
5656
apt update
5757
apt install -y git
5858
- uses: actions/checkout@v4
59+
60+
- name: Install build tools
61+
run: |
62+
./scripts/container.setup.sh
5963
6064
- name: Configure
6165
run: |
6266
git config --global --add safe.directory $PWD
6367
./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }}
68+
6469
- name: Build
6570
run:
6671
./scripts/cmake.build.sh
@@ -88,12 +93,20 @@ jobs:
8893
run: choco install ninja
8994
- name: Install gcovr
9095
if: ${{ matrix.BuildType == 'Profile' }}
91-
run: pip install git+https://github.com/gcovr/gcovr.git # gcovr==8.3
96+
run: pip install gcovr==8.3
9297

9398
- name: Configure
9499
run: ./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }}
100+
95101
- name: Build
96102
run: ./scripts/cmake.build.sh
103+
- name: Upload FileOp.7z
104+
if: always()
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: app-windows${{ matrix.BuildType == 'Profile' && '-profile' || ''}}
108+
path: build/FileOp.7z
109+
97110
- name: Test
98111
run: |
99112
./scripts/cmake.test.sh || ExitCode=$?
@@ -104,6 +117,12 @@ jobs:
104117
- name: Run performance test
105118
if: always()
106119
run: ./scripts/run_test_performance.sh 2>&1 | tee performance.txt
120+
- name: Upload performance report
121+
if: ${{ matrix.BuildType == 'Release' && always() }}
122+
uses: actions/upload-artifact@v4
123+
with:
124+
name: performance
125+
path: performance.txt
107126

108127
- name: Create coverage report
109128
if: ${{ matrix.BuildType == 'Profile' && always() }}
@@ -112,7 +131,6 @@ jobs:
112131
--filter src/ \
113132
--exclude-noncode-lines build \
114133
--txt coverage.txt \
115-
--markdown coverage.md --markdown-title "Test coverage report" --markdown-file-link 'https://github.com/Spacetown/FileOp/blob/${{ github.sha }}/{file}' \
116134
--json coverage.json --json-pretty \
117135
--html-single-page --html-title "GCOVR report for $(git rev-parse HEAD)" --html-details coverage.html
118136
cat coverage.txt
@@ -124,32 +142,30 @@ jobs:
124142
name: coverage
125143
path: coverage.*
126144

127-
- name: Upload ZIP
128-
if: always()
129-
uses: actions/upload-artifact@v4
130-
with:
131-
name: app-windows${{ matrix.BuildType == 'Profile' && '-profile' || ''}}
132-
path: build/FileOp.7z
133-
134-
- name: Add job summary
135-
if: ${{ matrix.BuildType == 'Profile' && always() }}
136-
run: |
137-
(
138-
cat coverage.md
139-
echo ""
140-
cat performance.txt
141-
) >> $GITHUB_STEP_SUMMARY
142-
143145
deploy:
144146
needs:
145147
- container-build
146148
- build
147149
runs-on: Windows-latest
150+
permissions:
151+
contents: write
148152
steps:
149-
- name: Download artifacts
153+
- uses: actions/checkout@v4
154+
- name: Set up environment
155+
run: |
156+
echo "FILEOP_VERSION=$(scripts/get_version.sh)" >> $GITHUB_ENV
157+
- name: Download apps
150158
uses: actions/download-artifact@v4
151159
with:
152160
pattern: app-*
161+
- name: Download coverage report
162+
uses: actions/download-artifact@v4
163+
with:
164+
name: coverage
165+
- name: Download performance report
166+
uses: actions/download-artifact@v4
167+
with:
168+
name: performance
153169
# cspell:ignore oapp
154170
- name: Test container release build
155171
run: |
@@ -163,3 +179,46 @@ jobs:
163179
run: |
164180
7z x -oapp-windows-profile app-windows-profile/FileOp.7z
165181
./app-windows-profile/FileOp.exe --help
182+
183+
- name: Create release notes
184+
run: |
185+
sed -n '/^## / { p; :a; n; /^## /q; p; ba; }' Changelog.md | sed -e 's/^## /# /;' > release_notes.md
186+
187+
- name: Add job summary
188+
run: |
189+
(
190+
cat release_notes.md
191+
echo ""
192+
echo "# Test coverage report"
193+
echo ""
194+
echo '```'
195+
cat coverage.txt
196+
echo '```'
197+
echo ""
198+
cat performance.txt
199+
) >> $GITHUB_STEP_SUMMARY
200+
201+
- name: Create new tag
202+
run: |
203+
# Set git user info
204+
git config --global user.email "noreply@zf.com"
205+
git config --global user.name "FileOp authors"
206+
207+
# Create the tag and print the output.
208+
sed -e "/^# / { s/^# //; s/$/ $(date -I)/; }" release_notes.md | tee commit_msg.txt
209+
git tag -a "$FILEOP_VERSION" -F commit_msg.txt
210+
git tag --list -n "$FILEOP_VERSION"
211+
212+
- name: Push new tag
213+
if: ${{ (github.repository == 'ZF-Group/FileOp') && (github.event.ref == 'refs/heads/main') && (env.FILEOP_VERSION != '0.0.0') }}
214+
run: |
215+
git push origin "refs/tags/$FILEOP_VERSION"
216+
217+
- name: Create release and upload build artifacts
218+
if: ${{ (github.repository == 'ZF-Group/FileOp') && (github.event.ref == 'refs/heads/main') && (env.FILEOP_VERSION != '0.0.0') }}
219+
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
220+
with:
221+
tag_name: ${{ env.FILEOP_VERSION }}
222+
body_path: release_notes.md
223+
files: ./app-windows/FileOp.exe
224+

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/.venv/
22
/build/
3-
/dockcross

Changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
<!-- cspell:ignore INFDTEP -->
55

6-
## Unreleased
6+
## 1.9.0
77

88
- First release under BSD 3-Clause License.
9-
- Use CMake and cross compiling with gcc-11.
9+
- Use CMake and cross compiling with mingw-w64 to be able to build on all systems running Docker.
1010

1111
## 1.8.0
1212

FileOp.code-workspace

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,19 @@
77
"settings": {
88
"actionButtons": {
99
"commands": [
10-
{
11-
"name": "Setup env",
12-
"command": "docker run --rm --platform linux/amd64 dockcross/windows-static-x64 > ./dockcross && chmod +x ./dockcross",
13-
"singleInstance": true
14-
},
1510
{
1611
"name": "Configure (Profile)",
17-
"command": "./dockcross --args '--platform linux/amd64' bash -c './scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=Profile'",
12+
"command": "./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=Profile",
1813
"singleInstance": true
1914
},
2015
{
2116
"name": "Configure (Release)",
22-
"command": "./dockcross --args '--platform linux/amd64' bash -c './scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=Release'",
17+
"command": "./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=Release",
2318
"singleInstance": true
2419
},
2520
{
2621
"name": "Build",
27-
"command": "./dockcross --args '--platform linux/amd64' bash -c './scripts/cmake.build.sh'",
22+
"command": "./scripts/cmake.build.sh",
2823
"singleInstance": true
2924
}
3025
],
@@ -40,7 +35,7 @@
4035
"seunlanlege.action-buttons",
4136
"streetsidesoftware.code-spell-checker",
4237
"EditorConfig.EditorConfig",
43-
"ms-vscode.cpptools-extension-pack"
38+
"ms-vscode.cpptools"
4439
]
4540
// cspell:enable
4641
}

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
[![Run FileOp CI](https://github.com/ZF-Group/FileOp/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ZF-Group/FileOp/actions/workflows/CI.yml)
3+
24
# FileOp
35

46
Tool for general file operations under Windows with support of file names longer than MAX_PATH (260 characters).
@@ -9,19 +11,24 @@ Windows command line tools only support paths with a maximum length of 260 chara
911
As workaround you need to subst the directory to a drive letter and delete the sub
1012
tree from there.
1113

12-
## Directory layout
14+
## Usage
1315

14-
dir | description
15-
--- | ---
16-
`build` | *ignored*: Storage of build-results
17-
`src` | Storage for source files
18-
`tests` | Storage for test scripts
16+
All supported commands are compiled into a single executable `FileOp.exe`. To get a list of commands
17+
and the available options you can execute `FileOp.exe --help`.
1918

2019
## Development
2120

2221
For development a workspace for `Visual Studio Code` is configured together with a cross compiler
2322
running under docker.
2423

24+
## Directory layout
25+
26+
| dir | description |
27+
| --------- | ----------------------------------- |
28+
| `build` | *ignored*: Storage of build results |
29+
| `scripts` | Storage for source files |
30+
| `src` | Storage for source files |
31+
2532
### Build
2633

2734
The project uses CMake and ninja for building the executable. The CMake configuration step is executed by
@@ -31,4 +38,4 @@ execute the tools.
3138

3239
### Test
3340

34-
To test the generated artifacts call `.\tools\test.cmd` or use `Terminal`->`Run Task...`->`Test` in the IDE.
41+
The test are also written in CMake and executed by calling [scripts/cmake.test.sh](./scripts/cmake.test.sh).

cspell.json

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
1-
{
2-
"version": "0.2",
3-
"files": [
4-
"/**"
5-
],
6-
"ignorePaths": [
7-
"/.git/",
8-
"src/mingw-unicode.c"
9-
],
10-
"dictionaryDefinitions": [],
11-
"dictionaries": [],
12-
"enableGlobDot": true,
13-
"words": [
14-
"choco",
15-
"devcontainers",
16-
"dockcross",
17-
"endgroup",
18-
"fileop",
19-
"gcov",
20-
"gcovr",
21-
"mapfile",
22-
"mklink",
23-
"msys",
24-
"noncode",
25-
"popd",
26-
"pushd",
27-
"STREQUAL",
28-
"venv",
29-
"windres"
30-
],
31-
"ignoreWords": [
32-
"WINXP",
33-
"endforeach",
34-
"endfunction",
35-
"noninteractive",
36-
"operationcopy",
37-
"seunlanlege"
38-
],
39-
"ignoreRegExpList": [
40-
// GH actions
41-
"uses: [^\\s]+/[^\\s]+@[^\\s]+",
42-
// Options
43-
"--[a-z0-9-]+",
44-
// CMAKE and GCC defines
45-
"-DCMAKE[A-Z_]*",
46-
"-DN?DEBUG",
47-
// Functions
48-
"tcs[a-z]+",
49-
"[a-z]+printf"
50-
],
51-
"import": []
52-
}
1+
{
2+
"version": "0.2",
3+
"files": [
4+
"/**"
5+
],
6+
"ignorePaths": [
7+
"/.git/",
8+
"src/mingw-unicode.c"
9+
],
10+
"dictionaryDefinitions": [],
11+
"dictionaries": [],
12+
"enableGlobDot": true,
13+
"words": [
14+
"choco",
15+
"cpptools",
16+
"devcontainers",
17+
"dockcross",
18+
"endgroup",
19+
"fileop",
20+
"gcov",
21+
"gcovr",
22+
"mapfile",
23+
"mklink",
24+
"msys",
25+
"noncode",
26+
"popd",
27+
"pushd",
28+
"STREQUAL",
29+
"venv",
30+
"windres"
31+
],
32+
"ignoreWords": [
33+
"WINXP",
34+
"endforeach",
35+
"endfunction",
36+
"noninteractive",
37+
"operationcopy",
38+
"seunlanlege"
39+
],
40+
"ignoreRegExpList": [
41+
// GH actions
42+
"uses: [^\\s]+/[^\\s]+@[^\\s]+",
43+
// Options
44+
"--[a-z0-9-]+",
45+
// CMAKE and GCC defines
46+
"-DCMAKE[A-Z_]*",
47+
"-DN?DEBUG",
48+
// Functions
49+
"tcs[a-z]+",
50+
"[a-z]+printf"
51+
],
52+
"import": []
53+
}

0 commit comments

Comments
 (0)