Skip to content

Commit 223f606

Browse files
authored
Merge pull request #114 from stevenengler/ci-fixes
Upgrade actions in CI workflows and fix python lint errors
2 parents 9716a86 + 14d6b0c commit 223f606

File tree

6 files changed

+35
-20
lines changed

6 files changed

+35
-20
lines changed

.github/workflows/cancel_prev_run_all_steps.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# instance to run at once per branch, canceling obsolete runs.
66
#
77
# Based on https://github.com/styfle/cancel-workflow-action#advanced-pull-requests-from-forks
8+
#
9+
# TODO: should we replace this with 'cancel-in-progress'?
10+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
811
name: Cancel previous run-all-steps
912
permissions: read-all
1013
on:

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
21+
with:
22+
persist-credentials: false
2123

2224
- name: Update packages
2325
run: sudo apt-get update
@@ -51,7 +53,9 @@ jobs:
5153
runs-on: ubuntu-latest
5254
steps:
5355
- name: Checkout
54-
uses: actions/checkout@v2
56+
uses: actions/checkout@v4
57+
with:
58+
persist-credentials: false
5559

5660
- name: Update packages
5761
run: sudo apt-get update

.github/workflows/parse_and_plot.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
2426

2527
- name: Update packages
2628
run: sudo apt-get update
@@ -85,7 +87,7 @@ jobs:
8587

8688
- name: Upload pdfs
8789
if: always()
88-
uses: actions/upload-artifact@v2
90+
uses: actions/upload-artifact@v4
8991
with:
9092
name: pdfs
9193
path: pdfs
@@ -94,7 +96,7 @@ jobs:
9496
# .github/workflows/parse_and_plot_output to a new expected output.
9597
- name: Upload plot data
9698
if: always()
97-
uses: actions/upload-artifact@v2
99+
uses: actions/upload-artifact@v4
98100
with:
99101
name: parse_and_plot_output
100102
path: parse_and_plot_output/tornet.plot.data

.github/workflows/run_all_steps.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ jobs:
4343
RUSTPROFILE: minimal
4444
steps:
4545
- name: Checkout
46-
uses: actions/checkout@v2
46+
uses: actions/checkout@v4
47+
with:
48+
persist-credentials: false
4749

4850
- name: Update packages
4951
run: sudo apt-get update
@@ -73,18 +75,19 @@ jobs:
7375
7476
- name: Restore shadow build cache
7577
id: restore-shadow-build-cache
76-
uses: actions/cache@v2
78+
uses: actions/cache@v4
7779
with:
7880
path: |
7981
~/opt/shadow
8082
key: shadow-${{ env.SHADOW_COMMIT }}-${{ env.CACHE_VERSION }}
8183

8284
- name: Checkout shadow
83-
uses: actions/checkout@v2
85+
uses: actions/checkout@v4
8486
with:
8587
repository: shadow/shadow
8688
ref: ${{ env.SHADOW_COMMIT }}
8789
path: shadow
90+
persist-credentials: false
8891

8992
- name: Install shadow deps
9093
run: |
@@ -104,7 +107,7 @@ jobs:
104107

105108
- name: Restore tor build cache
106109
id: restore-tor-build-cache
107-
uses: actions/cache@v2
110+
uses: actions/cache@v4
108111
with:
109112
path: |
110113
~/opt/tor
@@ -122,11 +125,12 @@ jobs:
122125
make install
123126
124127
- name: Checkout tgen
125-
uses: actions/checkout@v2
128+
uses: actions/checkout@v4
126129
with:
127130
repository: shadow/tgen
128131
ref: ${{ env.TGEN_COMMIT }}
129132
path: tgen
133+
persist-credentials: false
130134

131135
- name: Build tgen deps
132136
run: sudo apt-get install -y cmake gcc libglib2.0-dev libigraph-dev make
@@ -143,11 +147,12 @@ jobs:
143147
pip3 install -I ../tools
144148
145149
- name: Checkout oniontrace
146-
uses: actions/checkout@v2
150+
uses: actions/checkout@v4
147151
with:
148152
repository: shadow/oniontrace
149153
ref: ${{ env.ONIONTRACE_COMMIT }}
150154
path: oniontrace
155+
persist-credentials: false
151156

152157
- name: Install oniontrace deps
153158
run: sudo apt-get install -y cmake gcc libglib2.0-0 libglib2.0-dev make
@@ -165,7 +170,7 @@ jobs:
165170
166171
- name: Restore net data cache
167172
id: restore-net-data-cache
168-
uses: actions/cache@v2
173+
uses: actions/cache@v4
169174
with:
170175
path: netdata
171176
key: netdata-${{ env.NETDATA_MONTH }}-${{ env.NETDATA_LAST_DAY}}-${{ env.CACHE_VERSION }}
@@ -184,10 +189,11 @@ jobs:
184189
find consensuses-*/ -type f | tail -n +100 | xargs rm
185190
186191
- name: Checkout tmodel
187-
uses: actions/checkout@v2
192+
uses: actions/checkout@v4
188193
with:
189194
repository: tmodel-ccs2018/tmodel-ccs2018.github.io
190195
path: tmodel-ccs2018.github.io
196+
persist-credentials: false
191197

192198
- name: Install custom deps
193199
run: |
@@ -274,7 +280,7 @@ jobs:
274280
run: tornettools archive tornet
275281

276282
- name: Upload tornet
277-
uses: actions/upload-artifact@v2
283+
uses: actions/upload-artifact@v4
278284
if: failure()
279285
with:
280286
name: tornet
@@ -285,7 +291,7 @@ jobs:
285291
# necessary - e.g. when the output of the tgen or oniontrace parsers
286292
# changes in some significant way.
287293
- name: Upload parse_and_plot input
288-
uses: actions/upload-artifact@v2
294+
uses: actions/upload-artifact@v4
289295
with:
290296
name: parse_and_plot_input
291297
path: |
@@ -298,7 +304,7 @@ jobs:
298304
# Typically this is only needed when the output changes in some
299305
# significant way.
300306
- name: Upload plot data
301-
uses: actions/upload-artifact@v2
307+
uses: actions/upload-artifact@v4
302308
with:
303309
name: run_all_steps_output
304310
path: |
@@ -311,7 +317,7 @@ jobs:
311317
# the lines from the current run are not expected to be identical to the
312318
# lines from the previous run.
313319
- name: Upload plots
314-
uses: actions/upload-artifact@v2
320+
uses: actions/upload-artifact@v4
315321
with:
316322
name: plots
317323
path: pdfs/*.pdf

tornettools/plot_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __compute_sample_mean_and_error(bucket_list, confidence):
113113
resolution_variance = sum([res**2 for res in resolutions]) / 12
114114

115115
m, v = mean(emp_sample), var(emp_sample)
116-
assert(k == len(emp_sample))
116+
assert k == len(emp_sample)
117117
s = sqrt(v + resolution_variance / k)
118118
e = z * s
119119

tornettools/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def load_json_data(infile_path):
4949
return data
5050

5151
def find_matching_files_in_dir(search_dir, filepattern):
52-
if type(filepattern) == str:
52+
if isinstance(filepattern, str):
5353
# Interpret as a literal string
5454
logging.info(f"Searching for files containing {filepattern} in directory tree at {search_dir}")
5555
filepattern = re.compile('.*' + re.escape(filepattern) + '.*')
@@ -72,7 +72,7 @@ def find_matching_files_in_dir(search_dir, filepattern):
7272
# e.g.:
7373
# start_bytes = aka_int(2**20, 1048576)
7474
def aka_int(x, y):
75-
assert(x == y)
75+
assert x == y
7676
return x
7777

7878
# Looks for the given data point, first in

0 commit comments

Comments
 (0)