diff --git a/.github/workflows/Bash.yml b/.github/workflows/Bash.yml new file mode 100644 index 00000000..5e28ac43 --- /dev/null +++ b/.github/workflows/Bash.yml @@ -0,0 +1,37 @@ +name: Test Bash + +on: + push: + paths: + - 'Bash/**' + - '.github/workflows/Bash.yml' + pull_request: + paths: + - 'Bash/**' + - '.github/workflows/Bash.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up dependencies + working-directory: Bash + run: | + wget -nv https://github.com/SamirTalwar/smoke/releases/download/v2.3.0/smoke-v2.3.0-Linux-x86_64 + chmod 755 smoke-v2.3.0-Linux-x86_64 + mv smoke-v2.3.0-Linux-x86_64 smoke + + - name: Test + working-directory: Bash + run: | + export PATH=$PATH:$(pwd) + ./run_tests.sh + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/C.yml b/.github/workflows/C.yml new file mode 100644 index 00000000..9d13d581 --- /dev/null +++ b/.github/workflows/C.yml @@ -0,0 +1,37 @@ +name: Test C + +on: + push: + paths: + - 'C/**' + - '.github/workflows/C.yml' + pull_request: + paths: + - 'C/**' + - '.github/workflows/C.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up dependencies + run: | + sudo apt-get update + sudo apt-get install libcmocka-dev + + - name: Build + working-directory: C + run: gcc -std=c99 Parrot.c ParrotTest.c -l cmocka -o ParrotTest + + - name: Test + working-directory: C + run: ./ParrotTest + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/CSharp.yml b/.github/workflows/CSharp.yml new file mode 100644 index 00000000..708579df --- /dev/null +++ b/.github/workflows/CSharp.yml @@ -0,0 +1,41 @@ +name: Test CSharp + +on: + push: + paths: + - 'CSharp/**' + - '.github/workflows/CSharp.yml' + pull_request: + paths: + - 'CSharp/**' + - '.github/workflows/CSharp.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.0.x + + - name: Set up dependencies + working-directory: CSharp + run: dotnet restore + + - name: Build + working-directory: CSharp + run: dotnet build --no-restore + + - name: Test + working-directory: CSharp + run: dotnet test --no-build --verbosity normal + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Clojure.yml b/.github/workflows/Clojure.yml new file mode 100644 index 00000000..486f8bfa --- /dev/null +++ b/.github/workflows/Clojure.yml @@ -0,0 +1,44 @@ +name: Test Clojure + +on: + push: + paths: + - 'Clojure/**' + - '.github/workflows/Clojure.yml' + pull_request: + paths: + - 'Clojure/**' + - '.github/workflows/Clojure.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Set up Clojure + uses: DeLaGuardo/setup-clojure@3.2 + with: + lein: latest + - name: Cache lein + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-lein-${{ hashFiles('Clojure/project.clj') }} + restore-keys: ${{ runner.os }}-lein + + - name: Build and test + working-directory: Clojure + run: lein midje + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Crystal.yml b/.github/workflows/Crystal.yml new file mode 100644 index 00000000..6d3a49bf --- /dev/null +++ b/.github/workflows/Crystal.yml @@ -0,0 +1,31 @@ +name: Test Crystal + +on: + push: + paths: + - 'Crystal/**' + - '.github/workflows/Crystal.yml' + pull_request: + paths: + - 'Crystal/**' + - '.github/workflows/Crystal.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Crystal + uses: oprypin/install-crystal@v1 + + - name: Test + working-directory: Crystal + run: crystal spec + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Go.yml b/.github/workflows/Go.yml new file mode 100644 index 00000000..05356806 --- /dev/null +++ b/.github/workflows/Go.yml @@ -0,0 +1,33 @@ +name: Test Go + +on: + push: + paths: + - 'Go/**' + - '.github/workflows/Go.yml' + pull_request: + paths: + - 'Go/**' + - '.github/workflows/Go.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.14 + + - name: Test + working-directory: Go + run: go test -v + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Java.yml b/.github/workflows/Java.yml new file mode 100644 index 00000000..ec76281c --- /dev/null +++ b/.github/workflows/Java.yml @@ -0,0 +1,39 @@ +name: Test Java + +on: + push: + paths: + - 'Java/**' + - '.github/workflows/Java.yml' + pull_request: + paths: + - 'Java/**' + - '.github/workflows/Java.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('Java/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build and test + working-directory: Java + run: mvn -B test + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/JavaScript.yml b/.github/workflows/JavaScript.yml new file mode 100644 index 00000000..58db2337 --- /dev/null +++ b/.github/workflows/JavaScript.yml @@ -0,0 +1,37 @@ +name: Test JavaScript + +on: + push: + paths: + - 'JavaScript/**' + - '.github/workflows/JavaScript.yml' + pull_request: + paths: + - 'JavaScript/**' + - '.github/workflows/JavaScript.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 15.x + + - name: Set up dependencies + working-directory: JavaScript + run: npm install + + - name: Test + working-directory: JavaScript + run: npm test + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Kotlin.yml b/.github/workflows/Kotlin.yml new file mode 100644 index 00000000..04e9301b --- /dev/null +++ b/.github/workflows/Kotlin.yml @@ -0,0 +1,41 @@ +name: Test Kotlin + +on: + push: + paths: + - 'Kotlin/**' + - '.github/workflows/Kotlin.yml' + pull_request: + paths: + - 'Kotlin/**' + - '.github/workflows/Kotlin.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cache gradle wrapper + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('Kotlin/**/*.gradle*', 'Kotlin/**/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-gradle + + - name: Build and test + working-directory: Kotlin + run: ./gradlew clean test -i + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/LegacyJavaScript.yml b/.github/workflows/LegacyJavaScript.yml new file mode 100644 index 00000000..eeee9f44 --- /dev/null +++ b/.github/workflows/LegacyJavaScript.yml @@ -0,0 +1,37 @@ +name: Test LegacyJavaScript + +on: + push: + paths: + - 'LegacyJavaScript/**' + - '.github/workflows/LegacyJavaScript.yml' + pull_request: + paths: + - 'LegacyJavaScript/**' + - '.github/workflows/LegacyJavaScript.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 10.x + + - name: Set up dependencies + working-directory: LegacyJavaScript + run: npm install + + - name: Test + working-directory: LegacyJavaScript + run: npm test + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/PHP.yml b/.github/workflows/PHP.yml new file mode 100644 index 00000000..eca73d26 --- /dev/null +++ b/.github/workflows/PHP.yml @@ -0,0 +1,37 @@ +name: Test PHP + +on: + push: + paths: + - 'PHP/**' + - '.github/workflows/PHP.yml' + pull_request: + paths: + - 'PHP/**' + - '.github/workflows/PHP.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.3 + + - name: Set up dependencies + working-directory: PHP + run: composer install + + - name: Test + working-directory: PHP + run: ./vendor/bin/phpunit + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml new file mode 100644 index 00000000..7a2ae962 --- /dev/null +++ b/.github/workflows/Python.yml @@ -0,0 +1,40 @@ +name: Test Python + +on: + push: + paths: + - 'Python/**' + - '.github/workflows/Python.yml' + pull_request: + paths: + - 'Python/**' + - '.github/workflows/Python.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Set up dependencies + working-directory: Python + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest + + - name: Test + working-directory: Python + run: pytest # python -m nose + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Ruby.yml b/.github/workflows/Ruby.yml new file mode 100644 index 00000000..c7264987 --- /dev/null +++ b/.github/workflows/Ruby.yml @@ -0,0 +1,39 @@ +name: Test Ruby + +on: + push: + paths: + - 'Ruby/**' + - '.github/workflows/Ruby.yml' + pull_request: + paths: + - 'Ruby/**' + - '.github/workflows/Ruby.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.3 + + - name: Set up dependencies + working-directory: Ruby + run: | + gem install bundler + bundle install + + - name: Test + working-directory: Ruby + run: rake + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Rust.yml b/.github/workflows/Rust.yml new file mode 100644 index 00000000..5e14dec2 --- /dev/null +++ b/.github/workflows/Rust.yml @@ -0,0 +1,32 @@ +name: Test Rust + +on: + push: + paths: + - 'Rust/**' + - '.github/workflows/Rust.yml' + pull_request: + paths: + - 'Rust/**' + - '.github/workflows/Rust.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Build + working-directory: Rust + run: cargo build --verbose + + - name: Test + working-directory: Rust + run: cargo test --verbose + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Scala.yml b/.github/workflows/Scala.yml new file mode 100644 index 00000000..52841711 --- /dev/null +++ b/.github/workflows/Scala.yml @@ -0,0 +1,33 @@ +name: Test Scala + +on: + push: + paths: + - 'Scala/**' + - '.github/workflows/Scala.yml' + pull_request: + paths: + - 'Scala/**' + - '.github/workflows/Scala.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Build and test + working-directory: Scala + run: sbt clean test + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/Swift.yml b/.github/workflows/Swift.yml new file mode 100644 index 00000000..1c1be043 --- /dev/null +++ b/.github/workflows/Swift.yml @@ -0,0 +1,37 @@ +name: Test Swift + +on: + push: + paths: + - 'Swift/**' + - '.github/workflows/Swift.yml' + pull_request: + paths: + - 'Swift/**' + - '.github/workflows/Swift.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Setup Swift + uses: fwal/setup-swift@v1 + with: + swift-version: "5.5" + + - name: Build + working-directory: Swift + run: swift build + + - name: Test + working-directory: Swift + run: swift test + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/TypeScript-jest.yml b/.github/workflows/TypeScript-jest.yml new file mode 100644 index 00000000..c820c663 --- /dev/null +++ b/.github/workflows/TypeScript-jest.yml @@ -0,0 +1,37 @@ +name: Test TypeScript Jest + +on: + push: + paths: + - 'TypeScript/jest/**' + - '.github/workflows/TypeScript-jest.yml' + pull_request: + paths: + - 'TypeScript/jest/**' + - '.github/workflows/TypeScript-jest.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 15.x + + - name: Set up dependencies + working-directory: TypeScript/jest + run: npm install + + - name: Test + working-directory: TypeScript/jest + run: npm test + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/TypeScript-mocha-chai.yml b/.github/workflows/TypeScript-mocha-chai.yml new file mode 100644 index 00000000..cf735ab0 --- /dev/null +++ b/.github/workflows/TypeScript-mocha-chai.yml @@ -0,0 +1,37 @@ +name: Test TypeScript Mocha + +on: + push: + paths: + - 'TypeScript/mocha-chai/**' + - '.github/workflows/TypeScript-mocha-chai.yml' + pull_request: + paths: + - 'TypeScript/mocha-chai/**' + - '.github/workflows/TypeScript-mocha-chai.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 15.x + + - name: Set up dependencies + working-directory: TypeScript/mocha-chai + run: npm install + + - name: Test + working-directory: TypeScript/mocha-chai + run: npm test + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/cpp-catch2.yml b/.github/workflows/cpp-catch2.yml new file mode 100644 index 00000000..2e9ca92f --- /dev/null +++ b/.github/workflows/cpp-catch2.yml @@ -0,0 +1,38 @@ +name: Test Cpp Catch2 + +on: + push: + paths: + - 'cpp/catch2/**' + - '.github/workflows/cpp-catch2.yml' + pull_request: + paths: + - 'cpp/catch2/**' + - '.github/workflows/cpp-catch2.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Build + working-directory: cpp/catch2 + run: | + mkdir build + cd build + cmake .. + cmake --build . + + - name: Test + working-directory: cpp/catch2 + run: | + cd build + ctest + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/.github/workflows/cpp-gtest.yml b/.github/workflows/cpp-gtest.yml new file mode 100644 index 00000000..26b7c3bd --- /dev/null +++ b/.github/workflows/cpp-gtest.yml @@ -0,0 +1,38 @@ +name: Test Cpp Gtest + +on: + push: + paths: + - 'cpp/gtest/**' + - '.github/workflows/cpp-gtest.yml' + pull_request: + paths: + - 'cpp/gtest/**' + - '.github/workflows/cpp-gtest.yml' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Build + working-directory: cpp/gtest + run: | + mkdir build + cd build + cmake .. + cmake --build . + + - name: Test + working-directory: cpp/gtest + run: | + cd build + ctest + + - name: Report using branch name (dynamic, use for a pair on each branch) + run: | + export GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD) + export GIT_BRANCH_NAME=$( echo "$GIT_BRANCH_NAME" | sed 's/ /%20/g' ) + curl -X GET ${{ secrets.PUSH_COUNTER_URL }}/record/$GIT_BRANCH_NAME?build=green diff --git a/Java/pom.xml b/Java/pom.xml index 51465028..a6724faf 100644 --- a/Java/pom.xml +++ b/Java/pom.xml @@ -47,4 +47,4 @@ - \ No newline at end of file + diff --git a/Python/.gitignore b/Python/.gitignore index 4692a7a4..85a3b6de 100644 --- a/Python/.gitignore +++ b/Python/.gitignore @@ -6,3 +6,4 @@ __pycache__ .project .pydevproject .settings +.venv diff --git a/Python/parrot.py b/Python/parrot.py index 2d838480..b3b784a9 100644 --- a/Python/parrot.py +++ b/Python/parrot.py @@ -9,23 +9,13 @@ class ParrotType(Enum): # If it is not available, just remove it. class Parrot: - def __init__(self, type_of_parrot, number_of_coconuts, voltage, nailed): - self._type = type_of_parrot + def __init__(self, number_of_coconuts, voltage, nailed): self._number_of_coconuts = number_of_coconuts self._voltage = voltage self._nailed = nailed def speed(self): - if self._type == ParrotType.EUROPEAN: - return self._base_speed() - if self._type == ParrotType.AFRICAN: - return max(0, self._base_speed() - self._load_factor() * self._number_of_coconuts) - if self._type == ParrotType.NORWEGIAN_BLUE: - if self._nailed: - return 0 - else: - return self._compute_base_speed_for_voltage(self._voltage) - + print("Computing speed...") raise ValueError("should be unreachable") def _compute_base_speed_for_voltage(self, voltage): @@ -36,3 +26,18 @@ def _load_factor(self): def _base_speed(self): return 12.0 + +class EuropeanParrot(Parrot): + def speed(self): + return self._base_speed() + +class AfricanParrot(Parrot): + def speed(self): + return max(0, self._base_speed() - self._load_factor() * self._number_of_coconuts) + +class NorwegianParrot(Parrot): + def speed(self): + if self._nailed: + return 0 + else: + return self._compute_base_speed_for_voltage(self._voltage) diff --git a/Python/test_parrot.py b/Python/test_parrot.py index 7adeda44..68acad2c 100644 --- a/Python/test_parrot.py +++ b/Python/test_parrot.py @@ -1,36 +1,42 @@ -from parrot import Parrot, ParrotType +import unittest +from parrot import Parrot, AfricanParrot, EuropeanParrot, NorwegianParrot +class TestParrotCase(unittest.TestCase): + def test_speedOfEuropeanParrot(self): + parrot = EuropeanParrot(0, 0, False) + assert parrot.speed() == 12.0 -def test_speedOfEuropeanParrot(): - parrot = Parrot(ParrotType.EUROPEAN, 0, 0, False) - assert parrot.speed() == 12.0 + def test_speedOfAfricanParrot_With_One_Coconut(self): + parrot = AfricanParrot(1, 0, False) + assert parrot.speed() == 3.0 -def test_speedOfAfricanParrot_With_One_Coconut(): - parrot = Parrot(ParrotType.AFRICAN, 1, 0, False) - assert parrot.speed() == 3.0 + def test_speedOfAfricanParrot_With_Two_Coconuts(self): + parrot = AfricanParrot(2, 0, False) + assert parrot.speed() == 0.0 -def test_speedOfAfricanParrot_With_Two_Coconuts(): - parrot = Parrot(ParrotType.AFRICAN, 2, 0, False) - assert parrot.speed() == 0.0 + def test_speedOfAfricanParrot_With_No_Coconuts(self): + parrot = AfricanParrot(0, 0, False) + assert parrot.speed() == 12.0 -def test_speedOfAfricanParrot_With_No_Coconuts(): - parrot = Parrot(ParrotType.AFRICAN, 0, 0, False) - assert parrot.speed() == 12.0 + def test_speedNorwegianBlueParrot_nailed(self): + parrot = NorwegianParrot(0, 1.5, True) + assert parrot.speed() == 0.0 -def test_speedNorwegianBlueParrot_nailed(): - parrot = Parrot(ParrotType.NORWEGIAN_BLUE, 0, 1.5, True) - assert parrot.speed() == 0.0 + def test_speedNorwegianBlueParrot_not_nailed(self): + parrot = NorwegianParrot(0, 1.5, False) + assert parrot.speed() == 18.0 -def test_speedNorwegianBlueParrot_not_nailed(): - parrot = Parrot(ParrotType.NORWEGIAN_BLUE, 0, 1.5, False) - assert parrot.speed() == 18.0 + def test_speedNorwegianBlueParrot_not_nailed_high_voltage(self): + parrot = NorwegianParrot(0, 4, False) + assert parrot.speed() == 24.0 -def test_speedNorwegianBlueParrot_not_nailed_high_voltage(): - parrot = Parrot(ParrotType.NORWEGIAN_BLUE, 0, 4, False) - assert parrot.speed() == 24.0 + def test_parrot_raise(self): + parrot = Parrot(0, 4, False) + with self.assertRaises(ValueError) as ve: + parrot.speed() diff --git a/README.md b/README.md index caf2015e..c0871dde 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,66 @@ -Parrot Refactoring Kata -======================= +# Parrot Push Challenge + +Based on [Parrot Refactoring Kata by Emily Bache](https://github.com/emilybache/Parrot-Refactoring-Kata). + +## Mode and Constraint + +See [slides](https://www.slideshare.net/pkofler/coding-dojo-baby-steps-push-challenge-2021). + +## Supported Languages + +* Bash +* C +* Clojure +* cpp (gtest and catch2) +* Crystal +* CSharp +* Go +* Java +* JavaScript +* Kotlin +* LegacyJavaScript +* PHP +* Python +* Ruby +* Rust +* Scala +* Swift +* TypeScript (Mocha and Jest) + +### NOT Supported + +* Objective-C +* Pascal +* Scheme +* XSLT + +## Parrot Refactoring Kata Can you spot any code smells in this code? I'll give you a clue - a spot of Pol(l)ymorphism should improve matters! Refactor this code, take small steps, run the tests often. See how small and beautiful you can make it. -Acknowlegements ---------------- + +## How to start the challenge + +Clone the repo, checkout the branch `push-challenge`, and create your own branch from it. +> git clone git@github.com:alpescraft/Parrot-Refactoring-Kata.git + +Make sure you have read access to this repository. + +> git checkout push-challenge + + +> git checkout -b your_branch + +Then create your first commit, to test the workflow. And push it. + +> git commit -am "testing the flow" + +> git push -u origin your_branch + +Check your score on the dashboard: https://zictmyhave.eu-west-1.awsapprunner.com + +### Acknowledgements This code is heavily inspired by one of the examples in Martin Fowler's book "Refactoring". It's a classic, and if it's not on your bookshelf already I suggest you treat yourself to a copy! \ No newline at end of file