Skip to content

Commit

Permalink
Merge branch 'main' into protein-translation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmcalder authored Feb 3, 2024
2 parents c726d17 + b105d72 commit 3fe9011
Show file tree
Hide file tree
Showing 29 changed files with 637 additions and 86 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/no-important-files-changed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: No important files changed

on:
pull_request:
types: [opened]
branches: [main]

permissions:
pull-requests: write

jobs:
no_important_files_changed:
name: No important files changed
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Check if important files changed
id: check
run: |
set -exo pipefail
# fetch a ref to the main branch so we can diff against it
git remote set-branches origin main
git fetch --depth 1 origin main
for changed_file in $(git diff --diff-filter=M --name-only origin/main); do
if ! echo "$changed_file" | grep --quiet --extended-regexp 'exercises/(practice|concept)' ; then
continue
fi
slug="$(echo "$changed_file" | sed --regexp-extended 's#exercises/[^/]+/([^/]+)/.*#\1#' )"
path_before_slug="$(echo "$changed_file" | sed --regexp-extended "s#(.*)/$slug/.*#\\1#" )"
path_after_slug="$( echo "$changed_file" | sed --regexp-extended "s#.*/$slug/(.*)#\\1#" )"
if ! [ -f "$path_before_slug/$slug/.meta/config.json" ]; then
# cannot determine if important files changed without .meta/config.json
continue
fi
# returns 0 if the filter matches, 1 otherwise
# | contains($path_after_slug)
if jq --exit-status \
--arg path_after_slug "$path_after_slug" \
'[.files.test, .files.invalidator, .files.editor] | flatten | index($path_after_slug)' \
"$path_before_slug/$slug/.meta/config.json" \
> /dev/null;
then
echo "important_files_changed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "important_files_changed=false" >> "$GITHUB_OUTPUT"
- name: Suggest to add [no important files changed]
if: steps.check.outputs.important_files_changed == 'true'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
github-token: ${{ github.token }}
script: |
const body = "This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.\n\nIf this PR does **not** affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), **please add the following to the merge-commit message** which will stops student's tests from re-running. Please copy-paste to avoid typos.\n```\n[no important files changed]\n```\n\n For more information, refer to the [documentation](https://exercism.org/docs/building/tracks#h-avoiding-triggering-unnecessary-test-runs). If you are unsure whether to add the message or not, please ping `@exercism/maintainers-admin` in a comment. Thank you!"
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
56 changes: 37 additions & 19 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"slug": "lasagna",
"name": "Lasagna",
"uuid": "6fd75bbd-8654-4d6a-80b5-29344ceb8a48",
"concepts": ["basics"],
"concepts": [
"basics"
],
"prerequisites": [],
"status": "wip"
},
Expand Down Expand Up @@ -579,8 +581,8 @@
"prerequisites": [
"booleans"
],
"difficulty": 1,
"status": "wip"
"difficulty": 1,
"status": "wip"
},
{
"slug": "pythagorean-triplet",
Expand All @@ -602,13 +604,29 @@
"prerequisites": [],
"difficulty": 1
},
{
"slug": "roman-numerals",
"name": "Roman Numerals",
"uuid": "366d83ae-a069-457e-ace9-f79417ed311f",
"practices": [],
"prerequisites": [],
"difficulty": 1
},
{
"slug": "protein-translation",
"name": "Protein Translation",
"uuid": "dc8bb817-1c79-476a-a666-bcad9455c66a",
"practices": [],
"prerequisites": [],
"difficulty": 2
},
{
"slug": "eliuds-eggs",
"name": "Eliud's Eggs",
"uuid": "118e27fe-fe97-45fa-82cc-6480cf777e34",
"practices": [],
"prerequisites": [],
"difficulty": 1
}
]
},
Expand Down Expand Up @@ -636,45 +654,45 @@
],
"key_features": [
{
"icon": "scientific",
"title": "Domain Specific",
"content": "R is a language and environment for statistical computing and graphics."
"content": "R is a language and environment for statistical computing and graphics.",
"icon": "scientific"
},
{
"icon": "cross-platform",
"title": "Cross-platform",
"content": "It is free, open source, and available on every major platform."
"content": "It is free, open source, and available on every major platform.",
"icon": "cross-platform"
},
{
"icon": "multi-paradigm",
"title": "Multi-paradigm",
"content": "R has a functional programming foundation, but facilitates procedural or object-oriented approaches."
"content": "R has a functional programming foundation, but facilitates procedural or object-oriented approaches.",
"icon": "multi-paradigm"
},
{
"icon": "powerful",
"title": "Metaprogramming",
"content": "R’s metaprogramming capabilities allow for magically succinct and concise functions."
"content": "R’s metaprogramming capabilities allow for magically succinct and concise functions.",
"icon": "powerful"
},
{
"icon": "tooling",
"title": "Tooling",
"content": "R provides powerful tools for data manipulation, visualisation, modelling, and machine learning."
"content": "R provides powerful tools for data manipulation, visualisation, modelling, and machine learning.",
"icon": "tooling"
},
{
"icon": "community",
"title": "Community",
"content": "R has a diverse and welcoming community."
"content": "R has a diverse and welcoming community.",
"icon": "community"
}
],
"tags": [
"execution_mode/interpreted",
"paradigm/functional",
"paradigm/object_oriented",
"typing/dynamic",
"execution_mode/interpreted",
"platform/windows",
"platform/mac",
"platform/linux",
"platform/mac",
"platform/windows",
"runtime/language_specific",
"typing/dynamic",
"used_for/artificial_intelligence",
"used_for/scientific_calculations",
"used_for/scripts",
Expand Down
13 changes: 9 additions & 4 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
## Install the R runtime
Visit the [CRAN homepage](https://cran.r-project.org/). There you will find download links for Linux, Mac OSX, and Windows. Download and run the installer for your operating system.

## Install the RStudio IDE
## Install the RStudio IDE (Recommended)
RStudio is a popular cross-platform integrated development environment (IDE) for programming in R (and also supports other languages like Python, JavaScript, and Markdown). Using RStudio will make writing your code solutions and running tests easier.

Download and install the [current stable version of RStudio](https://www.rstudio.com/products/rstudio/download/). Or, alternatively, get the [preview version](https://www.rstudio.com/products/rstudio/download/preview/) of an upcoming release.

## Install the Visual Studio Code extension for R (Alternative)
The R extension for Visual Studio Code supports extended syntax highlighting, code completion, linting, formatting, interacting with R terminals, viewing data, plots, workspace variables, help pages, managing packages and working with R Markdown documents.

Download and install the [current version of R extension](https://code.visualstudio.com/docs/languages/r)

## Install the R packages for running tests
The test runner for the specs is the [`testthat`](https://github.com/hadley/testthat) library from Hadley Wickham, which is a popular choice for R package authors.

Expand All @@ -17,9 +22,9 @@ To install this library, type the following in your RStudio console (or wherever
install.packages("testthat")
```

While it is unlikely that you will _need_ to install packages to solve the exercism problems, you may want to bring in a general-purpose utility packages like [`magrittr`](https://github.com/smbache/magrittr) that suit your programming style. To install and load a package like `magrittr`:
While it is unlikely that you will _need_ to install packages to solve the exercism problems, you may want to bring in a general-purpose utility package like [`tidyverse`](https://github.com/tidyverse/tidyverse) that suit your programming style. To install and load a package like `tidyverse`:

```{R}
install.packages("magrittr")
library(magrittr)
install.packages("tidyverse")
library(tidyverse)
```
24 changes: 18 additions & 6 deletions exercises/concept/annalyns-infiltration/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
{
"authors": ["colinleach"],
"contributors": ["jonmcalder"],
"authors": [
"colinleach"
],
"contributors": [
"jonmcalder"
],
"files": {
"solution": ["annalyns-infiltration.R"],
"test": ["test_annalyns-infiltration.R"],
"exemplar": [".meta/exemplar.R"]
"solution": [
"annalyns-infiltration.R"
],
"test": [
"test_annalyns-infiltration.R"
],
"exemplar": [
".meta/exemplar.R"
]
},
"forked_from": ["Csharp/annalyns-infiltration"],
"forked_from": [
"Csharp/annalyns-infiltration"
],
"blurb": "Learn about booleans by contributing to a strategy game"
}
21 changes: 15 additions & 6 deletions exercises/concept/cars-assemble/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"authors": ["colinleach"],
"contributors": [],
"authors": [
"colinleach"
],
"files": {
"solution": ["cars-assemble.R"],
"test": ["test_cars-assemble.R"],
"exemplar": [".meta/exemplar.R"]
"solution": [
"cars-assemble.R"
],
"test": [
"test_cars-assemble.R"
],
"exemplar": [
".meta/exemplar.R"
]
},
"forked_from": ["Csharp/cars-assemble"],
"forked_from": [
"Csharp/cars-assemble"
],
"blurb": "Learn about conditionals by analyzing the production of an assembly line."
}
21 changes: 15 additions & 6 deletions exercises/concept/elyses-enchantments/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"authors": ["colinleach"],
"contributors": [],
"authors": [
"colinleach"
],
"files": {
"solution": ["elyses-enchantments.R"],
"test": ["test_elyses-enchantments.R"],
"exemplar": [".meta/exemplar.R"]
"solution": [
"elyses-enchantments.R"
],
"test": [
"test_elyses-enchantments.R"
],
"exemplar": [
".meta/exemplar.R"
]
},
"forked_from": ["javascript/elyses-enchantments"],
"forked_from": [
"javascript/elyses-enchantments"
],
"blurb": "Help Elyse with her Enchantments and learn about vectors in the process."
}
25 changes: 18 additions & 7 deletions exercises/concept/lasagna/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"authors": ["jonmcalder"],
"blurb": "Learn the basics of R by following a lasagna recipe.",
"icon": "lasagna",
"authors": [
"jonmcalder"
],
"files": {
"solution": ["lasagna.R"],
"test": ["test_lasagna.R"],
"exemplar": [".meta/examplar.R"]
"solution": [
"lasagna.R"
],
"test": [
"test_lasagna.R"
],
"exemplar": [
".meta/examplar.R"
]
},
"forked_from": ["csharp/basics", "ruby/basics"]
"forked_from": [
"csharp/basics",
"ruby/basics"
],
"icon": "lasagna",
"blurb": "Learn the basics of R by following a lasagna recipe."
}
4 changes: 3 additions & 1 deletion exercises/practice/armstrong-numbers/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"authors": ["colinleach"],
"authors": [
"colinleach"
],
"files": {
"solution": [
"armstrong-numbers.R"
Expand Down
1 change: 0 additions & 1 deletion exercises/practice/darts/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
".meta/example.R"
]
},
"title": "Darts",
"blurb": "Write a function that returns the earned points in a single toss of a Darts game.",
"source": "Inspired by an exercise created by a professor Della Paolera in Argentina"
}
8 changes: 8 additions & 0 deletions exercises/practice/eliuds-eggs/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Instructions

Your task is to count the number of 1 bits in the binary representation of a number.

## Restrictions

Keep your hands off that bit-count functionality provided by your standard library!
Solve this one yourself using other basic tools instead.
Loading

0 comments on commit 3fe9011

Please sign in to comment.