Skip to content

Commit

Permalink
Merge pull request #32 from swerik-project/dev
Browse files Browse the repository at this point in the history
prerelease: patch version
  • Loading branch information
BobBorges authored Jan 15, 2025
2 parents 3976ec1 + 8e6dfb3 commit 9fbfb5a
Show file tree
Hide file tree
Showing 27 changed files with 10,067 additions and 27 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Prerelease workflow

on:
pull_request:
branches:
- 'main'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # use GITHUB_TOKEN
fetch-depth: 1 # fetch depth is nr of commits
ref: ${{ github.head_ref }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyriksdagen
pip install pytest-cfg-fetcher
pip install pdoc
- name: Get release type
run: |
release_type=$(echo ${{ github.event.pull_request.title }} | grep -Eoh '(((M|m)ajor|inor)|(P|p)atch)')
if [ -z $release_type ] ; then
echo "::warning:: You have to indicate the release type in the title of a pr to main"
echo "::warning:: suggested pr title: `prerelease: major|minor|patch version`"
exit 1
else
echo "Next release will be a $release_type version"
echo "RELEASE_TYPE=$release_type" >> "$GITHUB_ENV"
fi
- name: Install jq
uses: dcarbone/install-jq-action@v2
with:
version: 1.7
force: false

- name: Get most recent release
run: |
LATEST_RELEASE=$(echo "$(curl -L https://api.github.com/repos/swerik-project/riksdagen-persons/releases/latest)" | jq -r .tag_name)
if [[ "$LATEST_RELEASE" == null ]] ; then LATEST_RELEASE="v0.0.0" ; fi
echo "LAST_RELEASE=$LATEST_RELEASE" >> "$GITHUB_ENV"
- name: Bump version
id: bump
uses: cbrgm/semver-bump-action@main
with:
current-version: ${{ env.LAST_RELEASE }}
bump-level: ${{ env.RELEASE_TYPE }}

- name: bump to env
run: |
echo "RELEASE_NR=${{ steps.bump.outputs.new_version }}" >> "$GITHUB_ENV"
- name: bump cff
run: |
sed -i.bak -e "s/\(^version:\)\([^\"]*\)/\1 ${{ env.RELEASE_NR }}/" CITATION.cff
cat CITATION.cff
- name: Estimate MP coverage
run: |
python quality/qe_mp-coverage.py
- name: Plot MP coverage
run: |
python quality/plot/mp-coverage/mp-coverage.py -v ${{ env.RELEASE_NR }}
- name: Validate CITATION.cff
uses: dieghernan/cff-validator@v3
with:
install-r: true

- name: Build documentation
run: |
echo "Release version ${{ env.RELEASE_NR }}"
pdoc -o docs --footer-text ${{ env.RELEASE_NR }} -t docs/dark-mode --logo https://raw.githubusercontent.com/swerik-project/the-swedish-parliament-corpus/refs/heads/main/readme/riksdagshuset.jpg ../riksdagen-persons
- name: Add and commit changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if [[ `git status CITATION.cff --porcelain --untracked-files=no` ]]; then
git add CITATION.cff
git commit -m "chore (workflow): bump version nr in cff file"
else
echo ""
echo "::warning:: WARNING!!! No changes to CITATION.cff file."
echo " Double check the version nr is correct."
echo ""
git commit --allow-empty -m "chore (workflow): no changes to CITATION.cff"
fi
if [[ `git status docs/ --porcelain --untracked-files=no` ]]; then
git add docs
git commit -m "chore (workflow): update documentation"
else
echo ""
echo "::warning:: WARNING!!! No changes to documentation files."
echo " Double check the version nr and everything else is up to date."
echo ""
git commit --allow-empty -m "chore (workflow): no changes to documentation"
fi
if [[ `git status quality/estimates/mp-coverage/ --porcelain --untracked-files=no` ]]; then
git add quality/estimates/mp-coverage/coverage-summary.txt
git add quality/estimates/mp-coverage/mp-coverage.csv
git add quality/estimates/mp-coverage/*.png
git commit -m "chore (workflow): update MP coverage quality estimation"
else
echo ""
echo "::warning:: WARNING!!! No changes detected in quality/estimates/mp-coverage/."
echo " Double check the version nr and everything else is up to date."
echo ""
git commit --allow-empty -m "chore (workflow): no changes to MP coverage quality estimation"
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
60 changes: 60 additions & 0 deletions .github/workflows/qe_mp-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Riksdagen Persons: Estimate MP coverage"

on:
pull_request:
branches:
- 'dev'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- name: Checkout PR source branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyriksdagen
- name: Estimate MP coverage
run: |
python quality/qe_mp-coverage.py
- name: Plot MP coverage
run: |
python quality/plot/mp-coverage/mp-coverage.py
- name: Add and commit changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if [[ `git status quality/estimates/mp-coverage/ --porcelain --untracked-files=no` ]]; then
git add quality/estimates/mp-coverage/coverage-summary.txt
git add quality/estimates/mp-coverage/mp-coverage.csv
# git add quality/estimates/mp-coverage/coverage.csv # this file is hyyuuuyuuggee
git add quality/estimates/mp-coverage/*.png
git commit -m "chore (workflow): update MP coverage quality estimation"
else
echo ""
echo "::warning:: WARNING!!! No changes detected in quality/estimates/mp-coverage/."
echo " Double check the version nr and everything else is up to date."
echo ""
git commit --allow-empty -m "chore (workflow): no changes to MP coverage quality estimation"
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ jobs:
python -m pip install --upgrade pip
pip install pyriksdagen
pip install cycler
- name: Zip metadata
run: zip -r persons.zip data

- name: Upload metadata to release
- name: zip quality estimates
run: zip -r quality.zip quality/estimates

- name: Upload artifacts to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: persons.zip
file: ./*.zip
tag: ${{ github.ref }}
file_glob: true
8 changes: 4 additions & 4 deletions .github/workflows/test-protocols.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test persons repo agains records for misplaced MPs"
name: "Test persons repo against records for misplaced MPs"

on:
pull_request:
Expand All @@ -24,23 +24,23 @@ jobs:
python -m pip install --upgrade pip
pip install pyriksdagen
pip install pytest-cfg-fetcher
- name: Install jq
uses: dcarbone/install-jq-action@v2
with:
version: 1.7
force: false

- name: get records
run: |
RECORDS_INFO="$(curl -L https://api.github.com/repos/swerik-project/riksdagen-records/releases/latest)"
RECORDS_TAG="$(echo $RECORDS_INFO | jq -r .tag_name)"
curl -LO https://github.com/swerik-project/riksdagen-records/archive/refs/tags/$RECORDS_TAG.zip
RECORDS_TAGNR=$(echo ${RECORDS_TAG:1})
ls -la
unzip $RECORDS_TAG.zip riksdagen-records-$RECORDS_TAGNR/test/*
unzip $RECORDS_TAG.zip riksdagen-records-$RECORDS_TAGNR/data/*
rsync -vr riksdagen-records-$RECORDS_TAGNR/ .
ls -l data
ls -l test
- name: mp-test
run: |
python -m unittest test.mp
20 changes: 0 additions & 20 deletions .github/workflows/validate-cff.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cff-version: 1.2.0
message: To cite this reposository, please use these metadata.
title: "The Swedish Parliament Corpus: Riksdagen Persons"
version: v1.0.0
version: v1.1.1
authors:
- given-names: Väinö
family-names: Yrjänäinen
Expand Down
80 changes: 80 additions & 0 deletions docs/dark-mode/syntax-highlighting.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* monokai color scheme, see pdoc/template/README.md */
pre { line-height: 125%; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 20px; }
.pdoc-code .hll { background-color: #49483e }
.pdoc-code { background: #272822; color: #f8f8f2 }
.pdoc-code .c { color: #75715e } /* Comment */
.pdoc-code .err { color: #960050; background-color: #1e0010 } /* Error */
.pdoc-code .esc { color: #f8f8f2 } /* Escape */
.pdoc-code .g { color: #f8f8f2 } /* Generic */
.pdoc-code .k { color: #66d9ef } /* Keyword */
.pdoc-code .l { color: #ae81ff } /* Literal */
.pdoc-code .n { color: #f8f8f2 } /* Name */
.pdoc-code .o { color: #f92672 } /* Operator */
.pdoc-code .x { color: #f8f8f2 } /* Other */
.pdoc-code .p { color: #f8f8f2 } /* Punctuation */
.pdoc-code .ch { color: #75715e } /* Comment.Hashbang */
.pdoc-code .cm { color: #75715e } /* Comment.Multiline */
.pdoc-code .cp { color: #75715e } /* Comment.Preproc */
.pdoc-code .cpf { color: #75715e } /* Comment.PreprocFile */
.pdoc-code .c1 { color: #75715e } /* Comment.Single */
.pdoc-code .cs { color: #75715e } /* Comment.Special */
.pdoc-code .gd { color: #f92672 } /* Generic.Deleted */
.pdoc-code .ge { color: #f8f8f2; font-style: italic } /* Generic.Emph */
.pdoc-code .gr { color: #f8f8f2 } /* Generic.Error */
.pdoc-code .gh { color: #f8f8f2 } /* Generic.Heading */
.pdoc-code .gi { color: #a6e22e } /* Generic.Inserted */
.pdoc-code .go { color: #66d9ef } /* Generic.Output */
.pdoc-code .gp { color: #f92672; font-weight: bold } /* Generic.Prompt */
.pdoc-code .gs { color: #f8f8f2; font-weight: bold } /* Generic.Strong */
.pdoc-code .gu { color: #75715e } /* Generic.Subheading */
.pdoc-code .gt { color: #f8f8f2 } /* Generic.Traceback */
.pdoc-code .kc { color: #66d9ef } /* Keyword.Constant */
.pdoc-code .kd { color: #66d9ef } /* Keyword.Declaration */
.pdoc-code .kn { color: #f92672 } /* Keyword.Namespace */
.pdoc-code .kp { color: #66d9ef } /* Keyword.Pseudo */
.pdoc-code .kr { color: #66d9ef } /* Keyword.Reserved */
.pdoc-code .kt { color: #66d9ef } /* Keyword.Type */
.pdoc-code .ld { color: #e6db74 } /* Literal.Date */
.pdoc-code .m { color: #ae81ff } /* Literal.Number */
.pdoc-code .s { color: #e6db74 } /* Literal.String */
.pdoc-code .na { color: #a6e22e } /* Name.Attribute */
.pdoc-code .nb { color: #f8f8f2 } /* Name.Builtin */
.pdoc-code .nc { color: #a6e22e } /* Name.Class */
.pdoc-code .no { color: #66d9ef } /* Name.Constant */
.pdoc-code .nd { color: #a6e22e } /* Name.Decorator */
.pdoc-code .ni { color: #f8f8f2 } /* Name.Entity */
.pdoc-code .ne { color: #a6e22e } /* Name.Exception */
.pdoc-code .nf { color: #a6e22e } /* Name.Function */
.pdoc-code .nl { color: #f8f8f2 } /* Name.Label */
.pdoc-code .nn { color: #f8f8f2 } /* Name.Namespace */
.pdoc-code .nx { color: #a6e22e } /* Name.Other */
.pdoc-code .py { color: #f8f8f2 } /* Name.Property */
.pdoc-code .nt { color: #f92672 } /* Name.Tag */
.pdoc-code .nv { color: #f8f8f2 } /* Name.Variable */
.pdoc-code .ow { color: #f92672 } /* Operator.Word */
.pdoc-code .w { color: #f8f8f2 } /* Text.Whitespace */
.pdoc-code .mb { color: #ae81ff } /* Literal.Number.Bin */
.pdoc-code .mf { color: #ae81ff } /* Literal.Number.Float */
.pdoc-code .mh { color: #ae81ff } /* Literal.Number.Hex */
.pdoc-code .mi { color: #ae81ff } /* Literal.Number.Integer */
.pdoc-code .mo { color: #ae81ff } /* Literal.Number.Oct */
.pdoc-code .sa { color: #e6db74 } /* Literal.String.Affix */
.pdoc-code .sb { color: #e6db74 } /* Literal.String.Backtick */
.pdoc-code .sc { color: #e6db74 } /* Literal.String.Char */
.pdoc-code .dl { color: #e6db74 } /* Literal.String.Delimiter */
.pdoc-code .sd { color: #e6db74 } /* Literal.String.Doc */
.pdoc-code .s2 { color: #e6db74 } /* Literal.String.Double */
.pdoc-code .se { color: #ae81ff } /* Literal.String.Escape */
.pdoc-code .sh { color: #e6db74 } /* Literal.String.Heredoc */
.pdoc-code .si { color: #e6db74 } /* Literal.String.Interpol */
.pdoc-code .sx { color: #e6db74 } /* Literal.String.Other */
.pdoc-code .sr { color: #e6db74 } /* Literal.String.Regex */
.pdoc-code .s1 { color: #e6db74 } /* Literal.String.Single */
.pdoc-code .ss { color: #e6db74 } /* Literal.String.Symbol */
.pdoc-code .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.pdoc-code .fm { color: #a6e22e } /* Name.Function.Magic */
.pdoc-code .vc { color: #f8f8f2 } /* Name.Variable.Class */
.pdoc-code .vg { color: #f8f8f2 } /* Name.Variable.Global */
.pdoc-code .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.pdoc-code .vm { color: #f8f8f2 } /* Name.Variable.Magic */
20 changes: 20 additions & 0 deletions docs/dark-mode/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:root {
--pdoc-background: #212529;
}

.pdoc {
--text: #f7f7f7;
--muted: #9d9d9d;
--link: #58a6ff;
--link-hover: #3989ff;
--code: #333;
--active: #555;

--accent: #343434;
--accent2: #555;

--nav-hover: rgba(0, 0, 0, 0.1);
--name: #77C1FF;
--def: #0cdd0c;
--annotation: #00c037;
}
7 changes: 7 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=./riksdagen-persons.html"/>
</head>
</html>
Loading

0 comments on commit 9fbfb5a

Please sign in to comment.