Skip to content

Commit

Permalink
Support running on MacOS Runners (#98)
Browse files Browse the repository at this point in the history
* Run tests against MacOS

* Switch to portable pseudorandom delimiter
  • Loading branch information
jamescurtin authored Oct 15, 2024
1 parent abb0df9 commit 314ebe9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- id: imports-properly-sorted
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- A [problem matcher](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) so you can see issues without trawling through logs

### Changed

- Update plugin to be POSIX-compliant to support usage on MacOS runners

### Fixed

- Packages are installed into a virtualenv due to the fact that system-wide
Expand Down
15 changes: 14 additions & 1 deletion bin/run_isort
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,20 @@ exit_code=$?
# output to be on a single line, so a (random) delimiter needs to be used
# so that the output is parsed properly.
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
DELIMITER=$(echo $RANDOM | md5sum | head -c 20)
# POSIX-compliant: see https://stackoverflow.com/a/50435453
DELIMITER=$(
awk '
BEGIN {
srand();
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
s = "";
for(i=0;i<8;i++) {
s = s "" substr(chars, int(rand()*62), 1);
}
print s
}
'
)
{
echo "isort-output<<${DELIMITER}"
echo "${isort_result}"
Expand Down

0 comments on commit 314ebe9

Please sign in to comment.