Skip to content

Commit

Permalink
New: Repo Config (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackSpagnoli authored Apr 4, 2024
1 parent d2b448d commit c0d8764
Show file tree
Hide file tree
Showing 17 changed files with 8,148 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye

# System updates
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y dist-upgrade \
&& apt-get -y install --no-install-recommends \
git make

USER vscode

# Install ASDF
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc;

ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/website/node_modules/.bin"

# Install ASDF plugins
RUN asdf plugin add python; \
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git;

WORKDIR /workspaces/fhir_prescription_creator
ADD .tool-versions /workspaces/website/.tool-versions
ADD .tool-versions /home/vscode/.tool-versions

RUN asdf install; \
asdf reshim python; \
asdf reshim nodejs;

# Install pip
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3 get-pip.py \
&& rm get-pip.py

# Install rust toolchains
RUN rustup toolchain install nightly \
&& rustup override set nightly

# Install Leptos
RUN cargo install trunk
RUN rustup target add wasm32-unknown-unknown
RUN cargo install leptosfmt
100 changes: 100 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"name": "Rust",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {}
},
"mounts": [
{
"source": "devcontainer-cargo-cache-${devcontainerId}",
"target": "/usr/local/cargo",
"type": "volume"
},
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind"
],
"customizations": {
"vscode": {
"extensions": [
"redhat.vscode-yaml",
"vadimcn.vscode-lldb",
"serayuzgur.crates",
"tamasfe.even-better-toml",
"GitHub.copilot",
"GitHub.copilot-chat",
"eamodio.gitlens",
"mutantdino.resourcemonitor",
"rust-lang.rust-analyzer",
"trunk.io",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"ms-vscode.hexeditor",
"streetsidesoftware.code-spell-checker",
"ms-azuretools.vscode-docker",
"jbockle.jbockle-format-files",
"codezombiech.gitignore"
],
"settings": {
"editor.formatOnPaste": false,
"editor.formatOnType": false,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"yaml.format.enable": true,
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
},
"files.associations": {
"*.md": "markdown",
"*.json": "json"
},
"formatFiles.useGitIgnore": true,
"formatFiles.excludedFolders": [
"node_modules",
".vscode",
".git",
"dist",
".chrome",
"target",
".trunk"
],
"rust-analyzer.rustfmt.overrideCommand": [
"leptosfmt",
"--stdin",
"--rustfmt"
],
"emmet.includeLanguages": {
"rust": "html",
"*.rs": "html"
},
"tailwindCSS.includeLanguages": {
"rust": "html",
"*.rs": "html"
},
"editor.quickSuggestions": {
"other": "on",
"comments": "on",
"strings": true
},
"css.validate": false,
"cSpell.words": ["leptos", "fhir"]
}
}
},
"postCreateCommand": "make install;"
}
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Pull Request Naming

Pull requests should be named using the following format:

```text
Tag: Short description
```

Tag can be one of:

- `Fix` - for a bug fix. (Patch release)
- `Update` - either for a backwards-compatible enhancement or for a rule change that adds reported problems. (Patch release)
- `New` - implemented a new feature. (Minor release)
- `Breaking` - for a backwards-incompatible enhancement or feature. (Major release)
- `Docs` - changes to documentation only. (Patch release)
- `Build` - changes to build process only. (No release)
- `Upgrade` - for a dependency upgrade. (Patch release)
- `Chore` - for refactoring, adding tests, etc. (anything that isn't user-facing). (Patch release)

The description of your pull request will be used as the commit message for the merge, and also be included in the changelog. Please ensure that your title is sufficiently descriptive.

### Rerunning Checks

If you need to rename your pull request, you can restart the checks by either:

- Closing and reopening the pull request
- Amend your last commit and force push to the branch
```bash
git commit --amend --no-edit
git push --force
```

Rerunning the checks from within the pull request will not use the updated title.
20 changes: 20 additions & 0 deletions .github/workflows/pr_title_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PR Title Check

on:
workflow_call:

jobs:
pr_title_format_check:
runs-on: ubuntu-latest
steps:
- name: Check PR Title is Prefixed with Change Type
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if [[ "$PR_TITLE" =~ ^(Fix|Update|New|Breaking|Docs|Build|Upgrade|Chore):.*$ ]]; then
echo "PR title is prefixed with change type."
else
echo "PR title is not prefixed with change type."
echo "Please prefix your PR title with a change type (Fix, Update, New, Breaking, Docs, Build, Upgrade, Chore)."
exit 1
fi
14 changes: 14 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Pull Request Checks

on:
pull_request:
branches: [main]

jobs:
quality_checks:
uses: ./.github/workflows/quality_checks.yml
with:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}

pr_title_format_check:
uses: ./.github/workflows/pr_title_check.yml
44 changes: 44 additions & 0 deletions .github/workflows/quality_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Quality Checks

on:
workflow_call:
inputs:
BRANCH_NAME:
type: string
required: true

jobs:
quality_checks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.BRANCH_NAME }}
fetch-depth: 0

# using git commit sha for version of action to ensure we have stable version
- name: Install asdf
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
with:
asdf_branch: v0.11.3

- name: Cache asdf
uses: actions/cache@v3
with:
path: |
~/.asdf
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
restore-keys: |
${{ runner.os }}-asdf-
- name: Install asdf dependencies in .tool-versions
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
with:
asdf_branch: v0.11.3
env:
PYTHON_CONFIGURE_OPTS: --enable-shared

- name: make install
run: |
make install
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Create Release

on:
workflow_dispatch:

jobs:
quality_checks:
uses: ./.github/workflows/quality_checks.yml
with:
BRANCH_NAME: main

release:
needs: quality_checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0

# using git commit sha for version of action to ensure we have stable version
- name: Install asdf
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
with:
asdf_branch: v0.11.3

- name: Cache asdf
uses: actions/cache@v3
with:
path: |
~/.asdf
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
restore-keys: |
${{ runner.os }}-asdf-
- name: Install asdf dependencies in .tool-versions
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
with:
asdf_branch: v0.11.3
env:
PYTHON_CONFIGURE_OPTS: --enable-shared

- name: make install
run: |
make install
# use semantic-release to determine the next version number
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
Loading

0 comments on commit c0d8764

Please sign in to comment.