Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Prepare for v3 #283

Merged
merged 27 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c743d7c
Add docs/reference split
ErikSchierboom Feb 26, 2020
6dffe46
Fix exercise directory structure
ErikSchierboom Jun 24, 2020
ec44932
Add stubs for concept documents
ErikSchierboom Oct 14, 2020
9598114
Add concept headings to introduction.md
ErikSchierboom Nov 10, 2020
7043fd4
Format code
SaschaMann Nov 24, 2020
995389c
Cleanup instructions headings
ErikSchierboom Jan 12, 2021
78a0f81
Add concept introductions
ErikSchierboom Jan 12, 2021
f24255f
[v3] Move existing exercises to exercises/practice
ErikSchierboom Jan 29, 2021
4a55381
[v3] Add version property to config.json
ErikSchierboom Jan 29, 2021
39956c6
[v3] Add status to config.json
ErikSchierboom Jan 29, 2021
b216510
[v3] Add slug to config.json
ErikSchierboom Jan 29, 2021
7347f29
[v3] Add online_editor property to config.json
ErikSchierboom Jan 29, 2021
56022f5
[v3] Re-order practice exercises in config.json
ErikSchierboom Jan 29, 2021
8e2a345
[v3] Remove deprecated properties from practice exercises in config.json
ErikSchierboom Jan 29, 2021
e7d63f7
[v3] Add name property to practice exercises in config.json
ErikSchierboom Jan 29, 2021
70cab91
[v3] Add (empty) prerequisites property to practice exercises in conf…
ErikSchierboom Jan 29, 2021
9e9be3d
[v3] Move exercises to practice exercises property in config.json
ErikSchierboom Jan 29, 2021
fd49dc8
[v3] Add concept exercises to config.json
ErikSchierboom Jan 29, 2021
2c5468c
[v3] Add wip status to concept exercises in config.json
ErikSchierboom Jan 29, 2021
bc8c7ec
[v3] Add concepts to config.json
ErikSchierboom Jan 29, 2021
d8f71d9
[v3] Add key features to config.json
ErikSchierboom Jan 29, 2021
1f46db4
[v3] Add tags to config.json
ErikSchierboom Jan 29, 2021
77fee12
[v3] Add configlet CI workflow
ErikSchierboom Jan 29, 2021
cb45590
[v3] Update fetch-configlet script to work with configlet v3
ErikSchierboom Jan 29, 2021
a053e31
[v3] Add dependabot to keep GHA dependencies up-to-date
ErikSchierboom Jan 29, 2021
38f212f
[v3] Convert relative v3 links to absolute links
ErikSchierboom Jan 29, 2021
8b0950f
[v3] Fix configlet CI workflow
ErikSchierboom Jan 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

updates:

# Keep dependencies for GitHub Actions up-to-date
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
16 changes: 16 additions & 0 deletions .github/workflows/configlet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Configlet CI

on: [push, pull_request, workflow_dispatch]

jobs:
configlet:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f

- name: Fetch configlet
uses: exercism/github-actions/configlet-ci@main

- name: Configlet Linter
run: configlet lint
68 changes: 37 additions & 31 deletions bin/fetch-configlet
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,54 @@ set -eo pipefail
readonly LATEST='https://api.github.com/repos/exercism/configlet/releases/latest'

case "$(uname)" in
(Darwin*) OS='mac' ;;
(Linux*) OS='linux' ;;
(Windows*) OS='windows' ;;
(MINGW*) OS='windows' ;;
(MSYS_NT-*) OS='windows' ;;
(*) OS='linux' ;;
Darwin*) os='mac' ;;
Linux*) os='linux' ;;
Windows*) os='windows' ;;
MINGW*) os='windows' ;;
MSYS_NT-*) os='windows' ;;
*) os='linux' ;;
esac

case "$OS" in
(windows*) EXT='zip' ;;
(*) EXT='tgz' ;;
case "${os}" in
windows*) ext='zip' ;;
*) ext='tgz' ;;
esac

case "$(uname -m)" in
(*64*) ARCH='64bit' ;;
(*686*) ARCH='32bit' ;;
(*386*) ARCH='32bit' ;;
(*) ARCH='64bit' ;;
*64*) arch='64bit' ;;
*686*) arch='32bit' ;;
*386*) arch='32bit' ;;
*) arch='64bit' ;;
esac

if [ -z "${GITHUB_TOKEN}" ]
then
HEADER=''
else
HEADER="authorization: Bearer ${GITHUB_TOKEN}"
curlopts=(
--silent
--show-error
--fail
--location
--retry 3
)

if [[ -n "${GITHUB_TOKEN}" ]]; then
curlopts+=(--header "authorization: Bearer ${GITHUB_TOKEN}")
fi

FILENAME="configlet-${OS}-${ARCH}.${EXT}"
suffix="${os}-${arch}.${ext}"

get_url () {
curl --header "$HEADER" -s "$LATEST" |
awk -v filename=$FILENAME '$1 ~ /browser_download_url/ && $2 ~ filename { print $2 }' |
tr -d '"'
get_download_url() {
curl "${curlopts[@]}" --header 'Accept: application/vnd.github.v3+json' "${LATEST}" |
grep "\"browser_download_url\": \".*/download/.*/configlet.*${suffix}\"$" |
cut -d'"' -f4
}

URL=$(get_url)
download_url="$(get_download_url)"
output_dir="bin"
output_path="${output_dir}/latest-configlet.${ext}"
curl "${curlopts[@]}" --output "${output_path}" "${download_url}"

case "$EXT" in
(*zip)
curl --header "$HEADER" -s --location "$URL" -o bin/latest-configlet.zip
unzip bin/latest-configlet.zip -d bin/
rm bin/latest-configlet.zip
;;
(*) curl --header "$HEADER" -s --location "$URL" | tar xz -C bin/ ;;
case "${ext}" in
*zip) unzip "${output_path}" -d "${output_dir}" ;;
*) tar xzf "${output_path}" -C "${output_dir}" ;;
esac

rm -f "${output_path}"
32 changes: 17 additions & 15 deletions bin/fetch-configlet.ps1
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
Function DownloadUrl ([string] $FileName, $Headers) {
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
$json = Invoke-RestMethod -Headers $Headers -Uri $latestUrl
$json.assets | Where-Object { $_.browser_download_url -match $FileName } | Select-Object -ExpandProperty browser_download_url
}
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

Function Headers {
If ($GITHUB_TOKEN) { @{ Authorization = "Bearer ${GITHUB_TOKEN}" } } Else { @{ } }
$requestOpts = @{
Headers = If ($env:GITHUB_TOKEN) { @{ Authorization = "Bearer ${env:GITHUB_TOKEN}" } } Else { @{ } }
MaximumRetryCount = 3
RetryIntervalSec = 1
}

Function Arch {
If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
$arch = If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
$fileName = "configlet-windows-$arch.zip"

Function Get-DownloadUrl {
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
Invoke-RestMethod -Uri $latestUrl -PreserveAuthorizationOnRedirect @requestOpts
| Select-Object -ExpandProperty assets
| Where-Object { $_.browser_download_url -match $FileName }
| Select-Object -ExpandProperty browser_download_url
}

$arch = Arch
$headers = Headers
$fileName = "configlet-windows-$arch.zip"
$downloadUrl = Get-DownloadUrl
$outputDirectory = "bin"
$outputFile = Join-Path -Path $outputDirectory -ChildPath $fileName
$zipUrl = DownloadUrl -FileName $fileName -Headers $headers

Invoke-WebRequest -Headers $headers -Uri $zipUrl -OutFile $outputFile
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts
Expand-Archive $outputFile -DestinationPath $outputDirectory -Force
Remove-Item -Path $outputFile
1 change: 1 addition & 0 deletions concepts/callbacks/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on callbacks concept
1 change: 1 addition & 0 deletions concepts/callbacks/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add introduction for callbacks concept
1 change: 1 addition & 0 deletions concepts/callbacks/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions concepts/errors-basic/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on errors-basic concept
1 change: 1 addition & 0 deletions concepts/errors-basic/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add introduction for errors-basic concept
1 change: 1 addition & 0 deletions concepts/errors-basic/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions concepts/futures/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on futures concept
3 changes: 3 additions & 0 deletions concepts/futures/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TODO: the content below is copied from the exercise introduction and probably needs rewriting to a proper concept introduction

## futures
1 change: 1 addition & 0 deletions concepts/futures/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions concepts/iterables-basic/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on iterables-basic concept
1 change: 1 addition & 0 deletions concepts/iterables-basic/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add introduction for iterables-basic concept
1 change: 1 addition & 0 deletions concepts/iterables-basic/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions concepts/numbers-basic/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on numbers-basic concept
5 changes: 5 additions & 0 deletions concepts/numbers-basic/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TODO: the content below is copied from the exercise introduction and probably needs rewriting to a proper concept introduction

## numbers-basic

## type-conversion
1 change: 1 addition & 0 deletions concepts/numbers-basic/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions concepts/recursion/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on recursion concept
1 change: 1 addition & 0 deletions concepts/recursion/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add introduction for recursion concept
1 change: 1 addition & 0 deletions concepts/recursion/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions concepts/strings-basic/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on strings-basic concept
5 changes: 5 additions & 0 deletions concepts/strings-basic/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Strings are useful for holding data that can be represented in text form. Some
of the most-used operations on strings are to check their `length`, to build
and concatenate them using the `+` and `+=` string operators, checking for the
existence or location of substrings with the `indexOf()` method, or extracting
substrings with the `substring()` method.
1 change: 1 addition & 0 deletions concepts/strings-basic/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions concepts/type-conversion/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: add information on type-conversion concept
5 changes: 5 additions & 0 deletions concepts/type-conversion/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TODO: the content below is copied from the exercise introduction and probably needs rewriting to a proper concept introduction

## numbers-basic

## type-conversion
1 change: 1 addition & 0 deletions concepts/type-conversion/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Loading