Skip to content

Commit

Permalink
Update CI to run MacOS tests on aarch64 (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 authored Dec 1, 2024
1 parent 1d47fe2 commit 290c5ef
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 9 deletions.
59 changes: 52 additions & 7 deletions .github/workflows/Benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ on:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
run-benchmark:
runs-on: ubuntu-latest
benchmark:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
include:
- os: macOS-latest
arch: aarch64
- os: ubuntu-latest
arch: x64

name: Benchmark on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
Expand All @@ -19,19 +31,52 @@ jobs:
uses: julia-actions/setup-julia@v2
with:
version: '1'
arch: ${{ matrix.arch }}

- uses: actions/cache@v4
with:
path: |
~/.julia
~/.julia/artifacts
key: ${{ runner.os }}-julia-benchmark-${{ matrix.arch }}-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}
restore-keys: |
${{ runner.os }}-julia-benchmark-${{ matrix.arch }}-
${{ runner.os }}-julia-benchmark-
- name: Run benchmarks
run: |
julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
julia --project=benchmark benchmark/run_benchmarks.jl > benchmark_results.txt
julia --project=benchmark benchmark/run_benchmarks.jl > benchmark_results_${{ matrix.os }}.txt
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark_results.txt
name: benchmark-results-${{ matrix.os }}
path: benchmark_results_${{ matrix.os }}.txt
retention-days: 7

post-results:
needs: benchmark
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- name: Download all benchmark results
uses: actions/download-artifact@v4

- name: Combine benchmark results
run: |
echo "Benchmark results on macOS (aarch64)" > combined_benchmark_results.txt
echo "" >> combined_benchmark_results.txt
cat benchmark-results-macOS-latest/benchmark_results_macOS-latest.txt >> combined_benchmark_results.txt
echo "" >> combined_benchmark_results.txt
echo "Benchmark results on Ubuntu (x64)" >> combined_benchmark_results.txt
echo "" >> combined_benchmark_results.txt
cat benchmark-results-ubuntu-latest/benchmark_results_ubuntu-latest.txt >> combined_benchmark_results.txt
echo "" >> combined_benchmark_results.txt
- name: Post results to PR
- name: Post combined results to PR
uses: marocchino/sticky-pull-request-comment@v2
with:
path: benchmark_results.txt
path: combined_benchmark_results.txt
recreate: true
4 changes: 2 additions & 2 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
fail-fast: false
matrix:
version: ['1', '1.9', 'nightly']
os: [ubuntu-latest, macOS-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
arch: [x64]
include:
- version: '1'
os: ubuntu-latest
arch: x64
coverage: true

steps:
- uses: actions/checkout@v4

Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/TestsMacOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Tests

on:
push:
branches: ["master"]
pull_request:

workflow_dispatch:

jobs:
test:
name: Julia ${{ matrix.version }} on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.version == 'nightly' }}
strategy:
fail-fast: false
matrix:
version: ['1', '1.9', 'nightly']
os: [macOS-latest]
arch: [aarch64]

steps:
- uses: actions/checkout@v4

- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}

- uses: actions/cache@v4
with:
path: |
~/.julia
~/.julia/artifacts
key: ${{ runner.os }}-julia-${{ matrix.version }}-${{ matrix.arch }}-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}
restore-keys: |
${{ runner.os }}-julia-${{ matrix.version }}-${{ matrix.arch }}-
${{ runner.os }}-julia-${{ matrix.version }}-
- uses: julia-actions/julia-buildpkg@v1

- name: Running elementary tests
uses: julia-actions/julia-runtest@v1
env:
TEST_GROUP: "elementary"

- name: Running compilation tests
uses: julia-actions/julia-runtest@v1
env:
TEST_GROUP: "compilation"

- name: Running `gibbs` tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true);"
env:
TEST_GROUP: "gibbs"

- name: Running `mcmchains` tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true);"
env:
TEST_GROUP: "mcmchains"

- uses: julia-actions/julia-processcoverage@v1
if: matrix.coverage

- uses: codecov/codecov-action@v4
if: matrix.coverage
with:
file: lcov.info

- uses: coverallsapp/github-action@master
if: matrix.coverage
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info

0 comments on commit 290c5ef

Please sign in to comment.