diff --git a/.github/workflows/artifacts_tests.yml b/.github/workflows/artifacts_tests.yml new file mode 100644 index 0000000..0c923e8 --- /dev/null +++ b/.github/workflows/artifacts_tests.yml @@ -0,0 +1,47 @@ +name: Artifact tests + +on: + workflow_dispatch: + +jobs: + generation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + #- name: Run test suite with cargo + # run: cargo test + - name: Generate data + run: python3 ci/fake_bench_data_generator.py my_test_results.json + shell: bash + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: results + path: my_test_results.json + + publication: + runs-on: ubuntu-latest + needs: generation + steps: + - uses: actions/checkout@v2 + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: results + path: results_artifact + + - name: Send data to slab + shell: bash + run: | + echo "Computing HMac on downloaded artifact" + SIGNATURE="$(./ci/hmac_calculator.sh ./results_artifact/my_test_results.json '${{ secrets.JOB_SECRET }}')" + + echo "Sending results to Slab..." + curl -v -k \ + -H "Content-Type: application/json" \ + -H "X-Slab-Repository: ${{ github.repository }}" \ + -H "X-Slab-Command: plot_data" \ + -H "X-Hub-Signature-256: sha256=${SIGNATURE}" \ + -d @results_artifact/my_test_results.json \ + ${{ secrets.SLAB_URL }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a53e62..a951171 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,11 +8,55 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + inputs: + instance_id: + description: 'Instance ID' + type: string + instance_image_id: + description: 'Instance AMI ID' + type: string + instance_type: + description: 'Instance product type' + type: string + runner_name: + description: 'Action runner name' + type: string + request_id: + description: 'Slab request ID' + type: string jobs: - tests: - runs-on: self-hosted + tests1: + #runs-on: ubuntu-latest + runs-on: ${{ github.event.inputs.runner_name }} steps: + - name: Instance configuration used + run: | + echo "IDs: ${{ github.event.inputs.instance_id }}" + echo "AMI: ${{ github.event.inputs.instance_image_id }}" + echo "Type: ${{ github.event.inputs.instance_type }}" + echo "Request ID: ${{ github.event.inputs.request_id }}" + echo "Matrix item: ${{ github.event.inputs.matrix_item }}" - uses: actions/checkout@v2 - - name: Run test suite with cargo - run: cargo test + #- name: Run test suite with cargo + # run: cargo test + - name: EC2 activity tracker check + #run: echo 999999^999999 | bc + run: sleep 45 +# +# intermediate_test: +# needs: tests1 +# runs-on: ubuntu-latest +# steps: +# - name: A intermediate sleep +# run: sleep 45 +# +# tests2: +# runs-on: ${{ github.event.inputs.runner_name }} +# needs: intermediate_test +# steps: +# - uses: actions/checkout@v2 +# #- name: Run test suite with cargo +# # run: cargo test +# - name: Another sleep +# run: echo 999999^999999 | bc diff --git a/ci/fake_bench_data_generator.py b/ci/fake_bench_data_generator.py new file mode 100644 index 0000000..ce1b986 --- /dev/null +++ b/ci/fake_bench_data_generator.py @@ -0,0 +1,41 @@ +import argparse +import pathlib +import json + +parser = argparse.ArgumentParser() +parser.add_argument("filename") + + +def create_data(): + return [{ + "series_name": "david_test_series", + "series_help": "A series used to test the whole CI chain", + "series_tags": {"tag_1": "spam", }, + "points": [ + {"value": 42.0, + "tags": { + "tag_2": "eggs", + }, + }, + {"value": 1234.0, + "tags": { + "tag_2": "ham", + }, + }, + {"value": 789.5, + "tags": { + "tag_2": "foo", + }, + }, + ], + }] + + +def dump_results(results, filename): + dump_file = pathlib.Path(filename) + dump_file.write_text(json.dumps(results)) + + +if __name__ == "__main__": + args = parser.parse_args() + dump_results(create_data(), args.filename) diff --git a/ci/hmac_calculator.sh b/ci/hmac_calculator.sh new file mode 100755 index 0000000..a389acd --- /dev/null +++ b/ci/hmac_calculator.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# +# Compute a Hmac signature by providing a filepath and a secret key encoded as hexadecimal. +# + +if [ $# -lt 2 ]; then + echo "Not enough argument provided" + echo "Usage: hmac_calculator.sh " + exit 1 +fi + +FILE_PROVIDED="$1" +SECRET_KEY="$2" + +if [ ! -f "${FILE_PROVIDED}" ]; then + echo "File $FILE_PROVIDED doesn't exist" + exit 1 +fi + +if [ -z "$SECRET_KEY" ]; then + echo "Hmac secret is empty" + exit 1 +fi + +# Compute HMAC signature. +openssl sha256 -hmac "$SECRET_KEY" < "${FILE_PROVIDED}" | sed -e 's/^.* //' diff --git a/ci/slab.toml b/ci/slab.toml new file mode 100644 index 0000000..191dbb9 --- /dev/null +++ b/ci/slab.toml @@ -0,0 +1,23 @@ +[profile.cpu] +region = "eu-west-3" +image_id = "ami-021d41cbdefc0c994" # AWS Linux x86 +instance_type = "t3.micro" +subnet_id = "subnet-0e042c7621461f754" + +[profile.gpu] +region = "eu-west-1" # Ireland +image_id = "ami-0261faf04cf54fe0a" # GPU image in eu-west-1 to test auto retry +instance_type = "p3.2xlarge" + +[command.cpu_test] +workflow = "main.yml" +profile = "cpu" +check_run_name = "AWS tests (Slab)" +#matrix = [2, 4, 6] +#max_parallel_jobs = 2 + +[command.gpu_test] +workflow = "main.yml" +profile = "gpu" +check_run_name = "AWS tests spawn GPU (Slab)" + diff --git a/src/alphabets.rs b/src/alphabets.rs index 277326c..1bd68b3 100644 --- a/src/alphabets.rs +++ b/src/alphabets.rs @@ -23,6 +23,7 @@ impl Alphabet for AsciiLowerCaseAlphabet { #[derive(Debug, Eq, PartialEq)] pub struct IncompleteAscii; +// A comment with no impact impl Alphabet for IncompleteAscii { fn letters() -> &'static [char] { const INCOMPLETE_ASCII: [char; 60] = [