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

Add a GH workflow to update crates versions weekly #40

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions .github/workflows/update-crate-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Update crates versions

defaults:
run:
shell: bash

on:
schedule:
# * is a special character in YAML, needs quoting
dhovart marked this conversation as resolved.
Show resolved Hide resolved
- cron: '0 0 * * 0'
workflow_dispatch:

jobs:
updateversions:
runs-on: ubuntu-latest
container:
image: rust:latest
dhovart marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Check out the code
uses: actions/checkout@v2
dhovart marked this conversation as resolved.
Show resolved Hide resolved
with:
fetch-depth: 0
dhovart marked this conversation as resolved.
Show resolved Hide resolved
- name: Retrieve newest versions of dependencies
run: |
echo 'cargo_toml<<EOF' >> $GITHUB_ENV
./bin/update-crates-versions.sh | sed 's/"/\\"/g' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Update Cargo.toml
run:
echo "${{env.cargo_toml}}" > local-registry/Cargo.toml
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above. @exercism/github-actions what do you think about this action?

Note that you can also use the GitHub CLI, which comes pre-installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, all right, I didn't know that the cli tools came pre-installed, I can create a PR this way if it's preferable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be slightly less susceptible to misuse (or errors)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if that would actually work since I'm specifying container to be rust:latest...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't. That said, it might be worth changing this workflow to be like https://github.com/exercism/rust/blob/main/.github/workflows/tests.yml#L113, which is the tests workflow for the rust repo. In it, the base image is ubuntu, but the action-rs action is used to install rust.

But let's wait for @exercism/github-actions to see what they think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, it's been a few months and I'd like to know why you stopped reviewing, it was nice contributing to exercism :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not the right person to review this, but at a guess, the people who'd been working with you on this PR got distracted and then just forgot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so sorry @dhovart! I guess @SaschaMann and I just forgot to review this. Our apologies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no worries at all :)

with:
commit-message: Update crates versions
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: update-crates-version
title: Update crates versions
body: |
Update crates versions

This is an auto-generated pull request.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"]
23 changes: 0 additions & 23 deletions bin/generate-registry.sh

This file was deleted.

15 changes: 15 additions & 0 deletions bin/update-crates-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/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 -i -r "s/^$crate =.*/$latest_version/" $MANIFEST
done <<< "$DEPS"

cat $MANIFEST
231 changes: 231 additions & 0 deletions local-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,234 @@ edition = "2021"
path = "dummy.rs"

[dependencies]
unicode-segmentation = "1.8.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great to have the dependencies listed here explicitly 👍

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"