Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
53a0c33
Make caliper matching less greedy
Oct 26, 2019
c28ce56
Make caliper matches closer
Oct 26, 2019
060c3dc
Fix a comment
Oct 26, 2019
80f93ee
Store CC0 license only once in LICENSE
michaelstepner Jun 10, 2022
e9e6538
Make calipmatch installable from Github
michaelstepner Jun 10, 2022
007ed9f
Improve code formatting and comments
michaelstepner Jun 10, 2022
2d5077a
Document improved algorithm in -help calipmatch-
michaelstepner Jun 10, 2022
3bd34be
Fix typo in README code
michaelstepner Jun 10, 2022
d2460f6
Add documentation comments to Mata functions
michaelstepner Jun 11, 2022
e421852
Add unit tests for incorrectly specified maximum matches and caliper …
Oct 9, 2022
93c5368
Added Performance Tests for Perfect Matching situation
Oct 9, 2022
fe89574
Add test for exact match is ambiguous
Oct 9, 2022
ca4755f
Add test for exact variable does not exist and fix typo in caliper va…
Oct 9, 2022
13dfe93
Removed duplicate of exact variable is ambiguous test
Oct 9, 2022
a66abc6
Add condition to maxmatch syntax that maxmatch be greater than 0, and…
Oct 11, 2022
a206861
Edit note for maximimum match is negative integer test
Oct 11, 2022
11588ae
Merge branch 'main' into develop
michaelstepner Oct 11, 2022
966e3df
Install Stata in GHA Runner
michaelstepner Oct 11, 2022
6535706
Add sudo to mkdir
michaelstepner Oct 11, 2022
2769e6c
Add more sudo to install Stata
michaelstepner Oct 11, 2022
2b4bc0d
Fix sudo with pipe
michaelstepner Oct 11, 2022
fa806ef
Run calipmatch Stata tests in GHA
michaelstepner Oct 11, 2022
75df89e
Run tests on PR commit; print output; catch errors
michaelstepner Oct 11, 2022
28c0b66
Deliberate Stata error to see if GHA detects it
michaelstepner Oct 11, 2022
332aeb5
Revert "Deliberate Stata error to see if GHA detects it"
michaelstepner Oct 11, 2022
ad791f2
Indicate when all tests are successful
michaelstepner Oct 11, 2022
77b98d0
Resolved merge conflicts by incorporating both suggestions.
Oct 12, 2022
de104a8
Set sortseed; provide more informative error msgs
michaelstepner Oct 12, 2022
2cb31f9
Added syntax requirement to max match in ado, corrected performance t…
Oct 12, 2022
b810f34
Corrected multiple maximum matches test
Oct 13, 2022
a18f051
Corrected multiple maximum matches test
Oct 13, 2022
8719592
Corrected perfect match test
Oct 13, 2022
ad3027c
Improved perfect match performance test
Oct 13, 2022
9b74789
Edit organization and formatting of tests
Oct 13, 2022
7b9c463
Merge branch 'develop' into newtests
Oct 13, 2022
6244634
Correction to one caliper, one exact matching testing
Oct 13, 2022
a069d74
Verify failed test: revert syntax improvement
michaelstepner Oct 19, 2022
6d2b390
Revert "Verify failed test: revert syntax improvement"
michaelstepner Oct 19, 2022
57613d3
Ensure that tests run calipmatch w/ verbatim args
michaelstepner Oct 19, 2022
ca8d033
Add whitespace to test_calipmatch commands
michaelstepner Oct 19, 2022
497a76c
Correct specified return code
michaelstepner Oct 19, 2022
0feb7cd
Fix another incorrect return code
michaelstepner Oct 19, 2022
47f4723
Refactor tests
michaelstepner Oct 19, 2022
2dc40ca
Merge pull request #2 from michaelstepner/newtests
michaelstepner Oct 19, 2022
25e3e35
GHA: auto-update calipmatch.sthlp in README (#3)
michaelstepner Oct 20, 2022
08b7798
Refactor: shared Stata installation bash script
michaelstepner Oct 20, 2022
a89be2a
GHA: Check out repo before installing Stata
michaelstepner Oct 20, 2022
43950f7
Update length of comment title separators
michaelstepner Oct 20, 2022
74e6b2a
Enable Stata 17 installs (#5)
michaelstepner Oct 25, 2022
cf1bb89
GHA: check if version number has incremented, auto-increment dates (#4)
michaelstepner Oct 26, 2022
99326d6
Test distance metric: minimize SSE (#6)
jethaaly Oct 27, 2022
849d221
Tweak README
michaelstepner Oct 27, 2022
5e09772
GHA: auto update README installation instructions (#7)
michaelstepner Oct 27, 2022
6f15e3a
README: update installation instructions
OppInsights-Bot Oct 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/readme_installation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: readme_installation

on:
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

jobs:
readme_installation:
runs-on: ubuntu-latest
timeout-minutes: 30 # change max time from default 6hr

steps:
#######################
# Configure
#######################

- name: Check out code repository (main branch)
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
if: github.event.pull_request.merged == true

- name: Check out code repository (head branch)
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
if: github.event.pull_request.merged != true

#######################
# Build
#######################

- name: Write installation instructions (main branch)
run: |
cat > readme_installation_instructions.md <<"EOL"
Install **calipmatch** in Stata from the SSC repository:
```
ssc install calipmatch
```

Or you can install **calipmatch** in Stata directly from this Github repository:
```
net install calipmatch, from(https://github.com/michaelstepner/calipmatch/raw/main)
```
EOL
if: github.event.pull_request.merged == true

- name: Write installation instructions (head branch)
run: |
cat > readme_installation_instructions.md <<"EOL"
This development version of **calipmatch** can be installed using:
```
net install calipmatch, from(https://github.com/michaelstepner/calipmatch/raw/${GITHUB_HEAD_REF})
```
EOL

sed -i "s/\${GITHUB_HEAD_REF}/${GITHUB_HEAD_REF}/" readme_installation_instructions.md
if: github.event.pull_request.merged != true

- name: Place installation instructions in README.md
run: |
sed -z -i 's/<!-- Begin installation instructions -->.*<!-- End installation instructions -->/<!-- Begin installation instructions -->\n\n<!-- End installation instructions -->/' README.md
sed -i '/<!-- Begin installation instructions -->/ r readme_installation_instructions.md' README.md
rm readme_installation_instructions.md

#######################
# Push
#######################

- name: Check if there are changes
run: |
set +e
test -z "$(git status --porcelain)"
echo "README_UPDATED=$?" >> $GITHUB_ENV

- name: Push updated README to Github
run: |
git config user.name OppInsights-Bot
git config user.email info@opportunityinsights.org
git pull --ff-only
git add README.md
git commit -m "README: update installation instructions"
git push
if: env.README_UPDATED == 1
67 changes: 67 additions & 0 deletions .github/workflows/readme_sthlp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: readme_sthlp

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'calipmatch.sthlp'
workflow_dispatch:

jobs:
readme_sthlp:
runs-on: ubuntu-latest
timeout-minutes: 30 # change max time from default 6hr

steps:
#######################
# Configure
#######################

- name: Check out code repository (main branch)
uses: actions/checkout@v3
if: github.ref == 'refs/heads/main'

- name: Check out code repository (PR branch)
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
if: github.ref != 'refs/heads/main'

- name: Install Stata
run: ./automation/install_stata.sh
env:
OI_HTTPS_PW: ${{ secrets.OI_HTTPS_PW }}
STATA_VERSION: 16

#######################
# Build
#######################

- name: Convert Stata help file to HTML
run: stata-mp log html calipmatch.sthlp calipmatch.html

- name: Place Stata help file in README.md
run: |
sed -z -i 's/<!-- Begin calipmatch.sthlp -->.*<!-- End calipmatch.sthlp -->/<!-- Begin calipmatch.sthlp -->\n\n<!-- End calipmatch.sthlp -->/' README.md
sed -i '/<!-- Begin calipmatch.sthlp -->/ r calipmatch.html' README.md
rm calipmatch.html

#######################
# Push
#######################

- name: Check if there are changes
run: |
set +e
test -z "$(git status --porcelain)"
echo "README_UPDATED=$?" >> $GITHUB_ENV

- name: Push updated README to Github
run: |
git config user.name OppInsights-Bot
git config user.email info@opportunityinsights.org
git pull --ff-only
git add README.md
git commit -m "README: update embedded calipmatch.sthlp"
git push
if: env.README_UPDATED == 1
29 changes: 27 additions & 2 deletions .github/workflows/stata_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: stata_tests

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
Expand All @@ -9,5 +11,28 @@ jobs:
timeout-minutes: 30 # change max time from default 6hr

steps:
- name: Hello World
run: echo "Hello World"
#######################
# Configure
#######################

- name: Check out code repository
uses: actions/checkout@v3

- name: Install Stata
run: ./automation/install_stata.sh
env:
OI_HTTPS_PW: ${{ secrets.OI_HTTPS_PW }}
STATA_VERSION: 16

#######################
# Build
#######################

- name: Run tests
run: |
stata-mp -b do test_calipmatch.do
cat test_calipmatch.log
if egrep --before-context=1 --max-count=1 "^r\([0-9]+\);$" test_calipmatch.log
then
exit 1
fi
144 changes: 144 additions & 0 deletions .github/workflows/version_increment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: version_increment

on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
paths:
- 'calipmatch.ado'
- 'calipmatch.sthlp'
- 'calipmatch.pkg'
workflow_dispatch:

jobs:
version_increment:
runs-on: ubuntu-latest
timeout-minutes: 30 # change max time from default 6hr

steps:
#######################
# Configure
#######################

- name: Check out repository, PR branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
path: pr

- name: Check out repository, main branch
uses: actions/checkout@v3
with:
ref: main
path: main

- name: Obtain 'version number' and 'changed date' from ado-file and help-file
run: |
for b in "pr" "main"; do
cd ${b}
echo "${b}_ado_version=$(head -n 1 calipmatch.ado | sed -nE 's/.*version ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p')" >> $GITHUB_ENV
echo "${b}_ado_date=$(head -n 1 calipmatch.ado | sed -nE 's/.*version [0-9]+\.[0-9]+\.[0-9]+ +([0-3]?[0-9][a-z][a-z][a-z][0-9][0-9][0-9][0-9]).*/\1/p')" >> $GITHUB_ENV

echo "${b}_help_version=$(sed '2q;d' calipmatch.sthlp | sed -nE 's/.*version ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p')" >> $GITHUB_ENV
echo "${b}_help_date=$(sed '2q;d' calipmatch.sthlp | sed -nE 's/.*version [0-9]+\.[0-9]+\.[0-9]+ +([0-3]?[0-9][a-z][a-z][a-z][0-9][0-9][0-9][0-9]).*/\1/p')" >> $GITHUB_ENV
cd ..
done

#######################
# Version numbers
#######################

- name: Validate ado-file version numbers exist
run: |
if [[ -z ${pr_ado_version} ]]; then
echo "PR branch: version number not detected in calipmatch.ado"
exit 1
fi
if [[ -z ${main_ado_version} ]]; then
echo "main branch: version number not detected in calipmatch.ado"
exit 1
fi

- name: Validate help-file version numbers exist
run: |
if [[ -z ${pr_help_version} ]]; then
echo "PR branch: version number not detected in calipmatch.sthlp"
exit 1
fi
if [[ -z ${main_help_version} ]]; then
echo "main branch: version number not detected in calipmatch.sthlp"
exit 1
fi

- name: Validate ado-file version numbers are incremented
run: |
for b in "pr" "main"; do
v=${b}_ado_version
printf -v "${b}_major" "%s" "$(echo "${!v}" | sed -nE 's/([0-9]+)\.[0-9]+\.[0-9]+/\1/p')"
printf -v "${b}_minor" "%s" "$(echo "${!v}" | sed -nE 's/[0-9]+\.([0-9]+)\.[0-9]+/\1/p')"
printf -v "${b}_patch" "%s" "$(echo "${!v}" | sed -nE 's/[0-9]+\.[0-9]+\.([0-9]+)/\1/p')"
done
if [[ ! $pr_major -gt $main_major ]] && [[ ! $pr_minor -gt $main_minor ]] && [[ ! $pr_minor -gt $main_minor ]]; then
echo "version number not incremented, pr=${pr_ado_version} main=${main_ado_version}"
exit 1
fi

- name: Validate help-file version numbers match ado-file version numbers
run: |
if [[ "$pr_ado_version" != "$pr_help_version" ]]; then
echo "version numbers in calipmatch.ado and calipmatch.sthlp do not match, ado=${pr_ado_version} sthlp=${pr_help_version}"
exit 1
fi
if [[ "$main_ado_version" != "$main_help_version" ]]; then
echo 'error in main branch:'
echo "version numbers in calipmatch.ado and calipmatch.sthlp do not match, ado=${main_ado_version} sthlp=${main_help_version}"
exit 1
fi

#######################
# Date last updated
#######################

- name: Update date in ado-file and help-file
run: |
today=$(TZ=America/New_York date +%-d%b%Y | tr A-Z a-z)
if [[ "$pr_ado_date" != "$today" ]]; then
sed -i "1s/${pr_ado_date}/${today}/" calipmatch.ado
fi
if [[ "$pr_help_date" != "$today" ]]; then
sed -i "2s/${pr_help_date}/${today}/" calipmatch.sthlp
fi
working-directory: pr

- name: Update date in package-file
run: |
if grep -q '^d Distribution-Date: [0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9]' calipmatch.pkg; then
sed -i "s/^d Distribution-Date: [0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9]/d Distribution-Date: $(TZ=America/New_York date +%Y%m%d)/" calipmatch.pkg
else
echo "PR branch: Distribution-Date not detected in calipmatch.pkg"
exit 1
fi
working-directory: pr

#######################
# Push
#######################

- name: Check if there are changes
run: |
set +e
test -z "$(git status --porcelain)"
echo "FILES_UPDATED=$?" >> $GITHUB_ENV
working-directory: pr

- name: Push updates to Github
run: |
git config user.name OppInsights-Bot
git config user.email info@opportunityinsights.org
git pull --ff-only
git add calipmatch.ado calipmatch.sthlp calipmatch.pkg
git commit -m "Update 'last updated' dates"
git push
if: env.FILES_UPDATED == 1
working-directory: pr
Loading