diff --git a/.github/workflows/update-crates-versions.yml b/.github/workflows/update-crates-versions.yml new file mode 100644 index 0000000..21976f0 --- /dev/null +++ b/.github/workflows/update-crates-versions.yml @@ -0,0 +1,38 @@ +name: Update crates versions + +defaults: + run: + shell: bash + +on: + schedule: + # Every Sunday at 00:00 + - cron: '0 0 * * 0' + workflow_dispatch: + +jobs: + updateversions: + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + with: + fetch-depth: 1 + - name: Setup rust toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af + with: + toolchain: stable + default: true + - name: Retrieve newest versions of dependencies + run: ./bin/update-crates-versions.sh + - name: Create pull request + run: | + git config --global user.email "githubbot@exercism.io" + git config --global user.name "Exercism Bot" + git checkout -b update-crates-versions + git add local-registry/Cargo.toml + git commit -m "Update crates versions" + git push -u origin update-crates-versions + gh pr create --title "Update crates versions" --body "This is an automated pull request" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 65063eb..94cd694 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,6 @@ RUN rm src/lib.rs COPY src/* src/ # build the executable RUN cargo build --release -COPY bin/generate-registry.sh ${wd}/bin/ # download jq RUN curl -L -o /usr/local/bin/jq "${JQ_URL}" \ && chmod +x /usr/local/bin/jq @@ -34,7 +33,7 @@ RUN curl -L -o clr.tar.gz "${CLR_URL}" \ # download popular crates to local registry WORKDIR /local-registry COPY local-registry/* ./ -RUN ${wd}/bin/generate-registry.sh +RUN cargo generate-lockfile && cargo local-registry --sync Cargo.lock . # As of Dec 2019, we need to use the nightly toolchain to get JSON test output FROM rustlang/rust:nightly AS test @@ -53,6 +52,4 @@ replace-with = "local-registry"\n\ local-registry = "/opt/test-runner/local-registry/"\n' >> $CARGO_HOME/config.toml # set entrypoint COPY bin/run.sh bin -COPY --from=build /usr/local/cargo/bin/cargo-local-registry /usr/local/cargo/bin/ -COPY bin/generate-registry.sh bin ENTRYPOINT ["bin/run.sh"] diff --git a/bin/generate-registry.sh b/bin/generate-registry.sh deleted file mode 100755 index 7c496d0..0000000 --- a/bin/generate-registry.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -export RUSTUP_HOME=/usr/local/rustup -export CARGO_HOME=/usr/local/cargo -export PATH=/usr/local/cargo/bin:$PATH - -cd /local-registry || cd /opt/test-runner/local-registry - -perl -i -p0e 's/(\[dependencies\]\n).*/$1/se' Cargo.toml - -# Uncomment after this file is added to exercism/rust (and remove file in current repo) -#curl -O -J https://raw.githubusercontent.com/exercism/rust/main/supported_crates - -# this can't be parallelized, there's a lock on package cache when using cargo search -append_dep() { - echo "retrieving info for $1..." - cargo search "$1" | head -n 1 >> Cargo.toml -} -while IFS= read -r crate - do append_dep "$crate" -done < supported_crates - -cargo generate-lockfile && cargo local-registry --sync Cargo.lock . diff --git a/bin/update-crates-versions.sh b/bin/update-crates-versions.sh new file mode 100755 index 0000000..f488b7d --- /dev/null +++ b/bin/update-crates-versions.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +MANIFEST=local-registry/Cargo.toml +DEP_LINE=$(grep -n "\[dependencies\]" $MANIFEST | cut -d : -f 1) +DEPS=$(tail -n +$(($DEP_LINE + 1)) $MANIFEST) + +while IFS= read -r line +do + crate=$(echo "$line" | awk -F"[ ]+" '{print $1}') + >&2 echo "Retrieving latest version of $crate..." + latest_version=$(cargo search "$crate" | head -n 1 | awk -F"[ ]+" '{print $1 " = " $3}' | sed 's/"/\\"/g') + sed -i "s/^$crate =.*/$latest_version/" $MANIFEST + done <<< "$DEPS" \ No newline at end of file diff --git a/local-registry/Cargo.toml b/local-registry/Cargo.toml index bf84061..abe9ad7 100644 --- a/local-registry/Cargo.toml +++ b/local-registry/Cargo.toml @@ -7,3 +7,234 @@ edition = "2021" path = "dummy.rs" [dependencies] +unicode-segmentation = "1.8.0" +chrono = "0.4.19" +itertools = "0.10.3" +rand = "0.8.4" +regex = "1.5.4" +lazy_static = "1.4.0" +rayon = "1.5.1" +time = "0.3.5" +num = "0.4.0" +unicode-reverse = "1.0.8" +maplit = "1.0.2" +crossbeam = "0.8.1" +num-traits = "0.2.14" +primes = "0.3.0" +num-bigint = "0.4.3" +modulo = "0.1.2" +criterion = "0.3.5" +num-integer = "0.1.44" +crossbeam-utils = "0.8.5" +bit-vec = "0.6.3" +strum = "0.23.0" +strum_macros = "0.23.1" +primal = "0.3.0" +once_cell = "1.8.0" +failure = "0.1.8" +counter = "0.5.2" +permutator = "0.4.0" +rstest = "0.11.0" +crossbeam-channel = "0.5.1" +bitflags = "1.3.2" +permutohedron = "0.2.4" +num-derive = "0.3.3" +ndarray = "0.15.4" +anyhow = "1.0.51" +nom = "7.1.0" +threadpool = "1.8.1" +cached = "0.26.2" +unicase = "2.6.0" +phf = "0.10.0" +libmath = "0.2.1" +unicode-normalization = "0.1.19" +rstest_reuse = "0.1.3" +petgraph = "0.6.0" +im = "15.0.0" +hexlit = "0.5.3" +enum-iterator = "0.7.0" +boolinator = "2.4.0" +uuid = "1.0.0-alpha.1" +num_enum = "0.5.4" +duplicate = "0.3.0" +divrem = "1.0.0" +pest = "2.1.3" +modinverse = "0.1.1" +dashmap = "4.0.2" +bit-set = "0.5.2" +bimap = "0.6.1" +voca_rs = "1.14.0" +unic-segment = "0.9.0" +thiserror = "1.0.30" +multiset = "0.0.5" +kmp = "0.1.1" +gcd = "2.0.2" +fnv = "1.0.7" +derivative = "2.2.0" +ascii = "1.0.0" +unicode_reader = "1.0.2" +unic-char-range = "0.9.0" +structopt = "0.3.25" +scan_fmt = "0.2.6" +pretty_assertions = "1.0.0" +pest_derive = "2.1.0" +multimap = "0.8.3" +try_opt = "0.2.0" +integer-sqrt = "0.1.5" +int-enum = "0.4.0" +indexmap = "1.7.0" +hashers = "1.0.1" +grapheme = "0.0.0" +factorial = "0.2.1" +eval = "0.4.3" +derive_more = "0.99.17" +counted-array = "0.1.2" +case = "1.0.0" +bitvec = "1.0.0-rc1" +arrayvec = "0.7.2" +Inflector = "0.11.4" +watch = "0.2.0" +stringsort = "2.0.0" +serde = "1.0.130" +rusqlite = "0.26.1" +reikna = "0.12.3" +modexp = "0.2.2" +mod_exp = "1.0.1" +lazysort = "0.2.1" +evalexpr = "6.6.0" +enumflags2 = "0.7.1" +enum_derive = "0.1.7" +custom_derive = "0.1.7" +char_stream = "0.1.8" +bytecount = "0.6.2" +bencher = "0.1.5" +unzip-n = "0.1.2" +unic-normal = "0.9.0" +transpose = "0.2.1" +test-case = "1.2.1" +subslice = "0.2.3" +strfmt = "0.1.6" +slow_primes = "0.1.14" +serde_derive = "1.0.130" +say-number = "1.0.0" +rustversion = "1.0.6" +rs_poker = "2.0.0-alpha.1" +recur-fn = "2.2.0" +readonly = "0.2.0" +rand_chacha = "0.3.1" +ramp = "0.6.0" +quickcheck_macros = "1.0.0" +quickcheck = "1.0.3" +proptest = "1.0.0" +prime_tools = "0.3.4" +peg = "0.7.0" +pcre = "0.2.3" +ordered-float = "2.8.0" +onig = "6.3.1" +num_cpus = "1.13.0" +luhn = "1.0.1" +linked_hash_set = "0.1.4" +linked-hash-map = "0.5.4" +libm = "0.2.1" +inflections = "1.1.1" +indicatif = "0.17.0-beta.1" +imageproc = "0.22.0" +image = "0.23.14" +if_chain = "1.0.2" +hashbag = "0.1.4" +generational-arena = "0.2.8" +frunk = "0.4.0" +factor = "0.4.0" +enum-primitive-derive = "0.2.2" +either = "1.6.1" +digits_iterator = "0.1.0" +csv = "1.1.6" +conv = "0.3.3" +compare = "0.1.0" +char-iter = "0.1.0" +caseless = "0.2.1" +binomial-iter = "0.1.0" +bigint = "4.4.3" +bigdecimal = "0.3.0" +async-std = "1.10.0" +async-channel = "1.6.1" +assert_float_eq = "1.1.3" +array_tool = "1.0.3" +z3 = "0.11.2" +xvii = "0.4.1" +workerpool = "1.2.0" +unidecode = "0.3.0" +unicode-case-mapping = "0.2.0" +unic-langid = "0.9.0" +tramp = "0.3.0" +tinyset = "0.4.6" +stringreader = "0.1.1" +static_assertions = "1.1.0" +spinning_top = "0.2.4" +sparse-bitfield = "0.11.0" +sliding_windows = "3.0.0" +simplelog = "0.11.0" +simple_parallel = "0.3.0" +serial_test = "0.5.1" +scoped_threadpool = "0.1.9" +scoped-pool = "1.0.0" +rustc-hash = "1.1.0" +rug = "1.14.0" +reduce = "0.1.4" +queues = "1.1.0" +pprof = "0.6.1" +phf_macros = "0.10.0" +pathfinding = "2.2.2" +out = "6.1.0" +numtoa = "0.2.4" +num-format = "0.4.0" +num-digitize = "0.4.2" +mustache = "0.9.0" +memoize = "0.1.9" +macro-attr = "0.2.0" +log = "0.4.14" +lexical-sort = "0.3.1" +left-pad = "1.0.1" +lalrpop-util = "0.19.6" +itoa = "0.4.8" +indoc = "1.0.3" +incremental-topo = "0.1.2" +humantime = "2.1.0" +hashbrown = "0.11.2" +genawaiter = "0.99.1" +futures-core = "0.3.18" +free-ranges = "1.0.7" +foreach = "0.3.0" +fluent = "0.16.0" +flamer = "0.4.0" +flame = "0.2.2" +flagset = "0.4.2" +fixedbitset = "0.4.0" +fasteval = "0.2.4" +fancy-regex = "0.7.1" +failure_derive = "0.1.8" +enumset = "1.0.8" +enum-utils = "0.1.2" +encode_unicode = "0.3.6" +easybench = "1.1.0" +divisors = "0.2.1" +dia-time = "6.1.0" +deunicode = "1.3.1" +defaultmap = "0.5.0" +cranelift-simplejit = "0.68.0" +cranelift-module = "0.78.0" +cranelift = "0.78.0" +cow-utils = "0.1.2" +convert_case = "0.4.0" +const_fn_assert = "0.1.2" +clap = "3.0.0-beta.5" +chomp = "0.3.1" +chashmap = "2.2.2" +change-case = "0.2.0" +cast = "0.3.0" +case_insensitive_hashmap = "1.0.0" +bstr = "0.2.17" +binary-heap-plus = "0.4.1" +as-slice = "0.2.1" +arr_macro = "0.1.3" +alloc_counter = "0.0.4"