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

ci(wasm): only run lcov commands if lcov.info has data in it #296

Merged
merged 10 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 20 additions & 0 deletions .github/citools/common/gh-setup-env
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ main() {

print_ruler

source /etc/profile.d/nodejs.sh || track_errors

printf "Adding Ruby paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/nodenv/bin" "/usr/local/nodenv/shims" | tee -a "${GITHUB_PATH}"

echo Adding source /etc/profile.d/nodejs.sh to ~/.bashrc
echo '. /etc/profile.d/nodejs.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

printf "Setup NodeJs symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .nodenv ]]; then
ln -sv "/usr/local/nodenv" .nodenv || track_errors
fi
ls -l ~/.nodenv
cd - || track_errors
printf "\n"

print_ruler

tail -n 1000 -v "${GITHUB_PATH}"

print_ruler
Expand Down
8 changes: 4 additions & 4 deletions .github/citools/wasm/wasm-setup-verify
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ declare -i retval=0
declare -A wasm_cmds

wasm_cmds=(
[npm]=$(
command -v npm >&/dev/null
[node]=$(
command -v node >&/dev/null
echo "$?"
)
[nodejs]=$(
command -v nodejs >&/dev/null
[npm]=$(
command -v npm >&/dev/null
echo "$?"
)
[yarn]=$(
Expand Down
10 changes: 6 additions & 4 deletions .github/citools/wasm/wasm-test-with-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ main() {

print_ruler

run_command lcov --list ./coverage/lcov.info
if [[ -s ./coverage/lcov.info ]]; then
run_command lcov --list ./coverage/lcov.info

print_ruler
print_ruler

run_command lcov --summary ./coverage/lcov.info
run_command lcov --summary ./coverage/lcov.info

print_ruler
print_ruler
fi

echo Exit code: "${retval}"
return "${retval}"
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ jobs:
id: config-wasm-tools
run: |-
./.github/citools/common/run_wrapper_script "./${{ matrix.exercise }}" ../../.github/citools/wasm/wasm-setup-config
- name: Install WebAssembly Tools [${{ matrix.exercise }}]
id: wasm-install
run: |-
./.github/citools/common/run_wrapper_script "./${{ matrix.exercise }}" ../../.github/citools/wasm/wasm-setup-install
- name: Show WebAssembly version [${{ matrix.exercise }}]
id: wasm-version
run: |-
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Exercism Workspace
| August | Apps | Dart (5/5), Java (0/5), Kotlin (0/5) |
| September | Slimline | Awk (5/5), Bash\* (5/5), jq (0/5), Perl (0/5) |
| October | Object-Oriented | Ruby (5/5), Java (0/5) |
| November | Nibbly | WebAssembly (0/5), x86-64 Assembly |
| November | Nibbly | WebAssembly (0/5), x86-64 Assembly (0/5) |
| December | Diversions | |

\* not completed in 2023
Expand Down Expand Up @@ -110,6 +110,10 @@ Exercism Workspace
[![CodeQL](https://github.com/vpayno/exercism-workspace/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/vpayno/exercism-workspace/actions/workflows/codeql-analysis.yml)
[![Docker Build](https://github.com/vpayno/exercism-workspace/actions/workflows/docker-build.yml/badge.svg)](https://github.com/vpayno/exercism-workspace/actions/workflows/docker-build.yml)

### CI Containers

- [ci-generic-debian](https://hub.docker.com/r/vpayno/ci-generic-debian/tags)

### Workflow Versions

- 1.0 - original versions
Expand Down
1 change: 1 addition & 0 deletions wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
## [Exercises](https://exercism.org/tracks/wasm/exercises)

- [hello-world](./hello-world/README.md)
- [two-fer](./two-fer/README.md)
14 changes: 14 additions & 0 deletions wasm/two-fer/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"root": true,
"extends": "@exercism/eslint-config-javascript",
"env": {
"jest": true
},
"overrides": [
{
"files": ["*.spec.js"],
"excludedFiles": ["custom.spec.js"],
"extends": "@exercism/eslint-config-javascript/maintainers"
}
]
}
24 changes: 24 additions & 0 deletions wasm/two-fer/.exercism/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"authors": [
"bushidocodes"
],
"files": {
"solution": [
"two-fer.wat"
],
"test": [
"two-fer.spec.js"
],
"example": [
".meta/proof.ci.wat"
]
},
"blurb": "Create a sentence of the form \"One for X, one for me.\".",
"source_url": "https://github.com/exercism/problem-specifications/issues/757",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
"flag.tests.may-run-long": false,
"flag.tests.includes-optional": false
}
}
1 change: 1 addition & 0 deletions wasm/two-fer/.exercism/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"track":"wasm","exercise":"two-fer","id":"83c741bfe77c439a95f06478c03c0f5b","url":"https://exercism.org/tracks/wasm/exercises/two-fer","handle":"vpayno","is_requester":true,"auto_approve":false}
1 change: 1 addition & 0 deletions wasm/two-fer/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
audit=false
1 change: 1 addition & 0 deletions wasm/two-fer/.prettierignore
72 changes: 72 additions & 0 deletions wasm/two-fer/HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Help

## Running the tests

## Setup

Go through the setup [instructions for WebAssembly][docs-exercism-wasm] to install the necessary dependencies.

## Requirements

Install assignment dependencies:

```shell
# Using npm
npm install

# Alternatively using yarn
yarn
```

## Making the test suite pass

All exercises come with a test suite to help you validate your solution before submitting.
You can execute these tests by opening a command prompt in the exercise's directory, and then running:

```bash
# Using npm
npm test

# Alternatively using yarn
yarn test
```

In some test suites all tests but the first have been skipped.

Once you get a test passing, you can enable the next one by changing `xtest` to `test`.

## Writing custom tests

If you wish to write additional, custom, tests, create a new file `custom.spec.js`, and submit it with your solution together with the new file:

```shell
exercism submit numbers.wat custom.spec.js
```

[docs-exercism-wasm]: https://exercism.org/docs/tracks/wasm/installation

## Submitting your solution

You can submit your solution using the `exercism submit two-fer.wat` command.
This command will upload your solution to the Exercism website and print the solution page's URL.

It's possible to submit an incomplete solution which allows you to:

- See how others have completed the exercise
- Request help from a mentor

## Need to get help?

If you'd like help solving the exercise, check the following pages:

- The [WebAssembly track's documentation](https://exercism.org/docs/tracks/wasm)
- The [WebAssembly track's programming category on the forum](https://forum.exercism.org/c/programming/wasm)
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)

Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.

To get help if you're having trouble, you can use one of the following resources:

- [/r/WebAssembly](https://www.reddit.com/r/WebAssembly/) is the WebAssembly subreddit.
- [Github issue tracker](https://github.com/exercism/wasm/issues) is where we track our development and maintenance of Javascript exercises in exercism. But if none of the above links help you, feel free to post an issue here.
21 changes: 21 additions & 0 deletions wasm/two-fer/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Exercism

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
58 changes: 58 additions & 0 deletions wasm/two-fer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Two Fer

Welcome to Two Fer on Exercism's WebAssembly Track.
If you need help running the tests or submitting your code, check out `HELP.md`.

## Introduction

In some English accents, when you say "two for" quickly, it sounds like "two fer".
Two-for-one is a way of saying that if you buy one, you also get one for free.
So the phrase "two-fer" often implies a two-for-one offer.

Imagine a bakery that has a holiday offer where you can buy two cookies for the price of one ("two-fer one!").
You go for the offer and (very generously) decide to give the extra cookie to a friend.

## Instructions

Your task is to determine what you will say as you give away the extra cookie.

If your friend likes cookies, and is named Do-yun, then you will say:

```text
One for Do-yun, one for me.
```

If your friend doesn't like cookies, you give the cookie to the next person in line at the bakery.
Since you don't know their name, you will say _you_ instead.

```text
One for you, one for me.
```

Here are some examples:

|Name |Dialogue
|:-------|:------------------
|Alice |One for Alice, one for me.
|Bohdan |One for Bohdan, one for me.
| |One for you, one for me.
|Zaphod |One for Zaphod, one for me.

## Reserved Addresses

The buffer for the input string uses bytes 128-192 of linear memory.

## Source

### Created by

- @bushidocodes

### Based on

https://github.com/exercism/problem-specifications/issues/757

### My Solution

- [my solution]()
- [run-tests](./run-tests-wasm.txt)
4 changes: 4 additions & 0 deletions wasm/two-fer/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
presets: ["@exercism/babel-preset-javascript"],
plugins: [],
};
6 changes: 6 additions & 0 deletions wasm/two-fer/coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1699243322499" clover="3.2.0">
<project timestamp="1699243322499" name="All files">
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
</project>
</coverage>
1 change: 1 addition & 0 deletions wasm/two-fer/coverage/coverage-final.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading