Skip to content

Commit bd1d2d9

Browse files
authored
ci: use a shared workflow (#1693)
* ci: use a shared workflow * ci: disable assertions for now * ci: run tests * test: remove unused deps * ci: fix common script * ci: fix cache name * ci: fix conflicting names + original timeout * ci: apply suggestions from code review
1 parent b39a1fc commit bd1d2d9

File tree

5 files changed

+277
-377
lines changed

5 files changed

+277
-377
lines changed

.github/workflows/CI-localjll.yml

Lines changed: 12 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches:
1010
- main
1111
- release-*
12-
tags: '*'
12+
tags: ['*']
1313
paths:
1414
- '.github/workflows/CI-localjll.yml'
1515
- 'deps/**'
@@ -21,157 +21,23 @@ concurrency:
2121
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
2222

2323
jobs:
24-
test:
25-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - local libReactant - ${{ github.event_name }}
26-
runs-on: ${{ matrix.os }}
27-
container:
28-
image: ${{ contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images@sha256:7004a6ebbdd77bd047900b2bffc542e8576864056dc27a9c94d30666d6f7ea01' || '' }}
24+
test-localjll:
2925
strategy:
3026
fail-fast: false
3127
matrix:
3228
version:
33-
- '1.10'
34-
- '1.11'
29+
- "1.10"
30+
- "1.11"
3531
os:
3632
- linux-x86-n2-32
3733
- macOS-latest
3834
exclude:
3935
- os: macOS-latest
40-
version: '1.10'
41-
steps:
42-
- name: Free Disk Space
43-
uses: jlumbroso/free-disk-space@main
44-
with:
45-
tool-cache: false
46-
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
47-
- name: Clean `/opt`
48-
run: sudo rm -rf /opt/*
49-
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
50-
- uses: actions/checkout@v5
51-
- name: Set and create TMPDIR
52-
# We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub
53-
# is terrible and the two don't match inside containers:
54-
# https://github.com/actions/runner/issues/2058
55-
run: |
56-
export TMPDIR="${GITHUB_WORKSPACE}/tmp"
57-
echo "TMPDIR=${TMPDIR}" >> "${GITHUB_ENV}"
58-
59-
mkdir -pv "${TMPDIR}"
60-
- uses: julia-actions/setup-julia@v2
61-
with:
62-
version: ${{ matrix.version }}
63-
- name: Load Julia packages from cache
64-
id: julia-cache
65-
uses: julia-actions/cache@v2
66-
- uses: bazel-contrib/[email protected]
67-
name: Set up Bazel
68-
with:
69-
# Avoid downloading Bazel every time.
70-
bazelisk-cache: true
71-
# Store build cache per workflow.
72-
disk-cache: ${{ github.workflow }}-${{ matrix.os }}-${{ matrix.version }}
73-
# Share repository cache between workflows.
74-
repository-cache: true
75-
bazelisk-version: 1.x
76-
- name: Prepare build on macOS
77-
if: ${{ startsWith(matrix.os, 'macOS-') }}
78-
run: |
79-
echo "SDKROOT=$(xcrun --show-sdk-path)" >> "${GITHUB_ENV}"
80-
- name: Install numpy
81-
if: ${{ startsWith(matrix.os, 'macOS-') }}
82-
run: |
83-
python -m pip install numpy
84-
- name: Build libReactant
85-
timeout-minutes: 120
86-
run: |
87-
julia --color=yes --project=deps -e 'using Pkg; Pkg.instantiate()'
88-
julia --color=yes --project=deps deps/build_local.jl
89-
cp LocalPreferences.toml test/
90-
- name: "Setup Runtime Preferences"
91-
run: |
92-
import Pkg
93-
Pkg.Registry.update()
94-
Pkg.instantiate()
95-
using Preferences
96-
Preferences.set_preferences!("Reactant", "xla_runtime" => "PJRT"; force=true)
97-
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
98-
env:
99-
JULIA_PKG_PRECOMPILE_AUTO: 0
100-
- name: "Install Dependencies"
101-
run: |
102-
import Pkg
103-
Pkg.Registry.update()
104-
# Install packages present in subdirectories
105-
dev_pks = Pkg.PackageSpec[]
106-
for path in ("lib/ReactantCore",)
107-
push!(dev_pks, Pkg.PackageSpec(; path))
108-
end
109-
Pkg.develop(dev_pks)
110-
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
111-
# Only in Julia v1.10 we need to install `ReactantCore` manually.
112-
if: ${{ matrix.version == '1.10' }}
113-
env:
114-
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
115-
- name: "Run Tests: PJRT"
116-
timeout-minutes: 200
117-
run: |
118-
import Pkg
119-
Pkg.Registry.update()
120-
Pkg.test(; coverage="user")
121-
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
122-
env:
123-
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
124-
XLA_FLAGS: "--xla_force_host_platform_device_count=12"
125-
JULIA_DEBUG: "Reactant,Reactant_jll"
126-
- name: Upload MLIR modules (PJRT)
127-
uses: actions/upload-artifact@v4
128-
timeout-minutes: 10
129-
if: ${{ always() }}
130-
with:
131-
name: "mlir-localjll-PJRT-${{ matrix.version }}-${{ matrix.os }}-${{ github.event_name }}"
132-
path: "**/*.mlir"
133-
retention-days: 90
134-
overwrite: false
135-
- name: "Setup Runtime Preferences"
136-
run: |
137-
import Pkg
138-
Pkg.Registry.update()
139-
Pkg.instantiate()
140-
using Preferences
141-
Preferences.set_preferences!("Reactant", "xla_runtime" => "IFRT"; force=true)
142-
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
143-
env:
144-
JULIA_PKG_PRECOMPILE_AUTO: 0
145-
- name: "Run Tests: IFRT"
146-
timeout-minutes: 200
147-
run: |
148-
import Pkg
149-
Pkg.Registry.update()
150-
Pkg.test(; coverage="user")
151-
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
152-
env:
153-
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
154-
XLA_FLAGS: "--xla_force_host_platform_device_count=12"
155-
JULIA_DEBUG: "Reactant,Reactant_jll"
156-
- name: Upload MLIR modules (IFRT)
157-
uses: actions/upload-artifact@v4
158-
timeout-minutes: 10
159-
if: ${{ always() }}
160-
with:
161-
name: "mlir-localjll-IFRT-${{ matrix.version }}-${{ matrix.os }}-${{ github.event_name }}"
162-
path: "**/*.mlir"
163-
retention-days: 90
164-
overwrite: false
165-
- name: Save Julia depot cache on cancel or failure
166-
id: julia-cache-save
167-
if: cancelled() || failure()
168-
uses: actions/cache/save@v4
169-
with:
170-
path: |
171-
${{ steps.julia-cache.outputs.cache-paths }}
172-
key: ${{ steps.julia-cache.outputs.cache-key }}
173-
- uses: julia-actions/julia-processcoverage@v1
174-
- uses: codecov/codecov-action@v5
175-
with:
176-
files: lcov.info
177-
token: ${{ secrets.CODECOV_TOKEN }}
36+
version: "1.10"
37+
uses: ./.github/workflows/CommonCI.yml
38+
with:
39+
julia_version: ${{ matrix.version }}
40+
os: ${{ matrix.os }}
41+
runtime: "both"
42+
assertions: false
43+
localjll: true

.github/workflows/CI.yml

Lines changed: 51 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
branches:
1414
- main
1515
- release-*
16-
tags: "*"
16+
tags: ["*"]
1717
paths:
1818
- ".github/workflows/CI.yml"
1919
- "ext/**"
@@ -30,11 +30,6 @@ concurrency:
3030

3131
jobs:
3232
test:
33-
timeout-minutes: 90
34-
name: Julia ${{ matrix.version }} - ${{ matrix.test_group }} - ${{ matrix.os }} - ${{ matrix.runtime }} - assertions=${{ matrix.assertions }} - ${{ github.event_name }}
35-
runs-on: ${{ matrix.os }}
36-
container:
37-
image: ${{ contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images:main' || '' }}
3833
strategy:
3934
fail-fast: false
4035
matrix:
@@ -52,137 +47,60 @@ jobs:
5247
# - macOS-13
5348
- macOS-latest
5449
- windows-latest
50+
- linux-x86-ct6e-180-4tpu
5551
test_group:
5652
- core
5753
- neural_networks
5854
- integration
5955
runtime:
60-
- "PJRT"
61-
- "IFRT"
62-
assertions:
63-
- false
64-
include:
56+
- "pjrt"
57+
- "ifrt"
58+
exclude:
6559
- os: linux-x86-ct6e-180-4tpu
66-
version: "1.11"
67-
assertions: false
68-
test_group: core
69-
runtime: "IFRT"
70-
- os: linux-x86-ct6e-180-4tpu
71-
version: "1.11"
72-
assertions: false
73-
test_group: integration
74-
runtime: "IFRT"
75-
- os: linux-x86-ct6e-180-4tpu
76-
version: "1.11"
77-
assertions: false
78-
test_group: neural_networks
79-
runtime: "IFRT"
80-
- os: ubuntu-24.04
81-
version: "1.10"
82-
assertions: true
83-
test_group: core
84-
runtime: "PJRT"
85-
- os: ubuntu-24.04
86-
version: "1.10"
87-
assertions: true
88-
test_group: neural_networks
89-
runtime: "PJRT"
90-
- os: ubuntu-24.04
9160
version: "1.10"
92-
assertions: true
93-
test_group: integration
94-
runtime: "PJRT"
95-
- os: ubuntu-24.04
96-
libReactant: packaged
97-
version: '1.10'
98-
test_group: core
99-
- os: ubuntu-24.04
100-
libReactant: packaged
101-
version: '1.10'
102-
test_group: neural_networks
103-
- os: ubuntu-24.04
104-
libReactant: packaged
105-
version: '1.10'
106-
test_group: integration
107-
steps:
108-
- name: Set TMPDIR
109-
# We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub
110-
# is terrible and the two don't match inside containers:
111-
# https://github.com/actions/runner/issues/2058
112-
113-
if: ${{ matrix.os != 'windows-latest' }}
114-
run: |
115-
echo "TMPDIR=${GITHUB_WORKSPACE}/tmp" >> ${GITHUB_ENV}
116-
- uses: actions/checkout@v5
117-
- name: Create TMPDIR
118-
if: ${{ matrix.os != 'windows-latest' }}
119-
run: |
120-
mkdir -p ${{ env.TMPDIR }}
121-
- uses: julia-actions/setup-julia@v2
122-
if: ${{ ! matrix.assertions }}
123-
with:
124-
version: ${{ matrix.version }}
125-
- uses: julia-actions/cache@v2
126-
- uses: actions/checkout@v5
127-
if: ${{ matrix.assertions }}
128-
with:
129-
repository: "JuliaLang/julia"
130-
ref: release-${{ matrix.version }}
131-
path: "julia"
132-
- name: Compile Julia
133-
if: ${{ matrix.assertions }}
134-
run: |
135-
sed -i.bak 's/exit 2/exit 0/g' julia/deps/tools/jlchecksum
136-
make -C julia -j $(nproc) FORCE_ASSERTIONS=1 LLVM_ASSERTIONS=1 JULIA_PRECOMPILE=0
137-
echo $PWD/julia/usr/bin >> $GITHUB_PATH
138-
- name: "Setup Runtime Preferences"
139-
uses: "DamianReeves/write-file-action@master"
140-
with:
141-
path: "LocalPreferences.toml"
142-
write-mode: "overwrite"
143-
contents: |
144-
[Reactant]
145-
xla_runtime = "${{ matrix.runtime }}"
146-
- name: "Install Dependencies"
147-
run: |
148-
import Pkg
149-
Pkg.Registry.update()
150-
# Install packages present in subdirectories
151-
dev_pks = Pkg.PackageSpec[]
152-
for path in ("lib/ReactantCore",)
153-
push!(dev_pks, Pkg.PackageSpec(; path))
154-
end
155-
Pkg.develop(dev_pks)
156-
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
157-
# Only in Julia v1.10 we need to install `ReactantCore` manually.
158-
if: ${{ matrix.version == '1.10' }}
159-
env:
160-
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
161-
- name: "Run Tests"
162-
timeout-minutes: 60
163-
run: |
164-
import Pkg
165-
Pkg.Registry.update()
166-
Pkg.test(; coverage="user")
167-
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
168-
id: run_tests
169-
env:
170-
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
171-
ENABLE_PJRT_COMPATIBILITY: 1
172-
REACTANT_TEST_GROUP: ${{ matrix.test_group }}
173-
XLA_FLAGS: "--xla_force_host_platform_device_count=12"
174-
JULIA_DEBUG: "Reactant,Reactant_jll"
175-
- name: Upload MLIR modules
176-
uses: actions/upload-artifact@v4
177-
timeout-minutes: 10
178-
if: ${{ always() }}
179-
with:
180-
name: "mlir-${{ matrix.version }}-${{ matrix.test_group }}-${{ matrix.os }}-${{ matrix.runtime }}-assertions=${{ matrix.assertions }}-${{ github.event_name }}"
181-
path: "**/*.mlir"
182-
retention-days: 90
183-
overwrite: false
184-
- uses: julia-actions/julia-processcoverage@v1
185-
- uses: codecov/codecov-action@v5
186-
with:
187-
files: lcov.info
188-
token: ${{ secrets.CODECOV_TOKEN }}
61+
- os: linux-x86-ct6e-180-4tpu
62+
runtime: "pjrt"
63+
uses: ./.github/workflows/CommonCI.yml
64+
with:
65+
julia_version: ${{ matrix.version }}
66+
os: ${{ matrix.os }}
67+
runtime: ${{ matrix.runtime }}
68+
test_group: ${{ matrix.test_group }}
69+
70+
# This has been broken for a while, originating from CUDA.jl
71+
# test-assertions:
72+
# strategy:
73+
# fail-fast: false
74+
# matrix:
75+
# version:
76+
# - "1.10"
77+
# test_group:
78+
# - core
79+
# - neural_networks
80+
# - integration
81+
# uses: ./.github/workflows/CommonCI.yml
82+
# with:
83+
# julia_version: ${{ matrix.version }}
84+
# os: "ubuntu-24.04"
85+
# runtime: "both"
86+
# assertions: true
87+
# test_group: ${{ matrix.test_group }}
88+
89+
downgrade:
90+
strategy:
91+
fail-fast: false
92+
matrix:
93+
test_group:
94+
- core
95+
- neural_networks
96+
- integration
97+
runtime:
98+
- "pjrt"
99+
- "ifrt"
100+
uses: ./.github/workflows/CommonCI.yml
101+
with:
102+
julia_version: "1.10"
103+
os: "ubuntu-24.04"
104+
runtime: ${{ matrix.runtime }}
105+
test_group: ${{ matrix.test_group }}
106+
downgrade_testing: true

0 commit comments

Comments
 (0)