Skip to content

Commit 9c7501c

Browse files
Add a .github action to build DIRECTORY.md (#36)
* Add a .github action to build DIRECTORY.md * Update gh action build_directory_md * Add ignored paths and git credentials * chore: minor Gitpod improvements (#34) Add Gitpod badge and prebuilds for all branches and forks * Add binary search (#37) * Add binary search * Update binary search: add recursive version * Update binary search: better description * Update binary search: update runnableExamples * Update binary search: improve tests, add overload for recursive func * Update binary search: evaluate if-expression into result * grammar * Update binary search: improve description, add comments * Update binary search: add missing test cases * Update binary search: add info about pivot choice in description, rearrange it * Update binary search: change int to Natural * Update binary search: if block -> guard clause * Update binary search: test cases * Update binary search: simplify docs * Update binary search: nimpretty * Apply suggestions from code review Co-authored-by: David Leal <[email protected]> * Replace by an attempt of github pr create * Fix branching and environment variable in the PR Co-authored-by: David Leal <[email protected]> * Create and populate the Maths directory (#4) * Add a sample of maths basic algorithms * Update maths/abs.nim Co-authored-by: Zoom <[email protected]> * Use openArray in absMaxSort Co-authored-by: Zoom <[email protected]> * Fix seq->openArray and int->SomeInteger * Use Positive as input instead * Update maths/addition_without_arithmetic.nim Co-authored-by: Pietro Peterlongo <[email protected]> * Name allocation number * [maths/abs] Replace maxAbsSort by signed[Min/Max]Abs * [Aliquot Sum] Add header * Add empty line at end of file * Remove Allocation number since it is a non standard algorithm * Fix titles * Run nimpretty on the files * Rename file and add DIRECTORY.md --------- Co-authored-by: Dimitri LESNOFF <[email protected]> Co-authored-by: David Leal <[email protected]> * Add arc length (#10) * Fix linear search (#33) * Use a dynamic allocated array (sequence) for strings * Run nimpretty * Add requested changes * Fix documentation generation * Fix test title according to changes Co-authored-by: Satin Wuker <[email protected]> * Update comments to warn about indexing issues Modified a bit the suggestions of comments. Please check them before approving. Co-authored-by: Zoom <[email protected]> --------- Co-authored-by: Dimitri LESNOFF <[email protected]> Co-authored-by: Zoom <[email protected]> * chore: run `apt-get update` before running other commands (#41) This will run `sudo apt-get update` before running any other commands on the Gitpod prebuild image (`.gitpod.dockerfile`). * Readme: fix gitter link, add Nim logo, formatting fixes (#42) * Update README.md Use more extended markdown syntax instead of HTML, Add Matrix links Superseed PR #40 * Actually fix gitter! Move img src links to footer. Also changed the TheAlgorithms logo image link. * Restore TheAlgorithms logo link * More link fixes --------- Co-authored-by: dlesnoff <[email protected]> * fix: nimpretty for `arc_length.nim` (#43) * chore: `gc`->`mm`, move back to `config.nims` (#47) * chore: revert #41 (#45) * Update codeowners * Fix: CONTRIBUTING.md links (#49) Uppercase `directory.md` to `DIRECTORY.md` * feat: add Levenshtein distance (#46) * feat: add Levenshtein distance * Apply suggestions from code review Co-authored-by: Zoom <[email protected]> * refactor: use toKey in initSubsolutions * style: use .Natural * style: remove blank line * refactor: add Key type * style: use descriptive variable names * style: use a, b instead of strA, strB * docs: add note about complexity * refator: add name to TestCase * docs: remove sentence about dp * docs: update documentation of `levenshteinDistance` Co-authored-by: Zoom <[email protected]> * docs: rename initLevenshteinDistanceMatrix and add its documentation * refactor: add fillLevenshteinDistanceMatrix * tests: reorganise tests, remove TestCase type * docs: add edit distance to module-level documentation * docs: mention Wagner–Fischer algorithm * docs: add comment in fillLevenshteinDistanceMatrix * style: reformat fillLevenshteinDistanceMatrix * docs: update DIRECTORY.md --------- Co-authored-by: Zoom <[email protected]> * docs: add missing `#` (#50) * docs: add missing `#` * docs: update DIRECTORY.md * docs: remove ` of a Circle` * docs: update DIRECTORY.md --------- Co-authored-by: dlesnoff <[email protected]> * Fix: Remove unuseful date command * chore: Update checkout version to v4 in build_directory_md * Add error status checking + separate compilation and execution of directory.nim --------- Co-authored-by: Dimitri LESNOFF <[email protected]> Co-authored-by: David Leal <[email protected]>
1 parent c9c8077 commit 9c7501c

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: build_directory_md
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- 'main'
10+
paths-ignore:
11+
- '.github/**'
12+
- '.scripts/**'
13+
- 'DIRECTORY.md'
14+
15+
jobs:
16+
build_directory_md:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: jiro4989/setup-nim-action@v1
22+
23+
- name: Build file
24+
run: |
25+
git clean -f -x -d
26+
27+
# Compile the script first
28+
nim c -o:directory_script .scripts/directory.nim
29+
compile_status=$?
30+
if [ $compile_status -ne 0 ]; then
31+
echo "Compilation of directory.nim failed with exit code $compile_status!"
32+
exit $compile_status
33+
fi
34+
35+
# Run the compiled script
36+
./directory_script > DIRECTORY.md
37+
exec_status=$?
38+
if [ $exec_status -ne 0 ]; then
39+
echo "Execution of directory.nim script failed with exit code $exec_status!"
40+
exit $exec_status
41+
fi
42+
43+
- name: Setup Git configurations
44+
run: |
45+
git config --global user.name github-actions[bot]
46+
git config --global user.email '[email protected]'
47+
- name: Commit and push changes
48+
run: |
49+
git checkout -b directory_update-${{ github.sha }}
50+
51+
git add DIRECTORY.md
52+
53+
git commit -m "docs: update DIRECTORY.md"
54+
git push origin directory_update-${{ github.sha }}:directory_update-${{ github.sha }}
55+
- name: Create a pull request
56+
run: |
57+
if [[ $(git log --branches --not --remotes) ]]; then
58+
gh pr create --base ${GITHUB_REF##*/} --head directory_update-${{ github.sha }} --title 'docs: update DIRECTORY.md' --body 'Updated the DIRECTORY.md file (see the diff. for changes).'
59+
fi
60+
61+
...

0 commit comments

Comments
 (0)