Skip to content

Commit b03c455

Browse files
authored
Parallelize CI (#2001)
1 parent 658524b commit b03c455

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

.github/workflows/artifacts.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929
}
3030
3131
const pullNumber = context.payload.workflow_run.pull_requests[0].number;
32-
const artifactUrl = artifacts.data.artifacts[0].archive_download_url;
32+
const artifactId = artifacts.data.artifacts[0].id;
33+
const artifactUrl = `${context.payload.workflow_run.artifacts_url}/${artifactId}`;
3334
const commentBody = `<!-- build-artifact-comment -->\n📦 Docs artifacts are ready: ${artifactUrl}`;
3435
3536
const comments = await github.rest.issues.listComments({

.github/workflows/ci.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ env:
66
MIX_ENV: test
77

88
jobs:
9-
elixir_js_and_lint:
9+
assets:
1010
runs-on: ubuntu-20.04
1111
strategy:
1212
matrix:
@@ -29,35 +29,24 @@ jobs:
2929
key: ${{ runner.os }}-node-${{ hashFiles('asssets/package-lock.json') }}
3030

3131
- run: npm ci --prefix assets
32+
- run: npm run build --prefix assets
3233

3334
# Setup Elixir
3435
- uses: erlef/setup-beam@v1
3536
with:
3637
otp-version: ${{ matrix.otp }}
3738
elixir-version: ${{ matrix.elixir }}
3839

39-
- run: mix deps.get
40-
4140
# Generate and upload artifacts
4241
- name: Generate docs
43-
run: |
44-
mix build
45-
test -f doc/index.html && echo "doc/index.html exists."
46-
test -f doc/ExDoc.epub && echo "doc/ExDoc.epub exists."
42+
run: test/prerelease.sh
4743

4844
- name: Upload docs
4945
uses: actions/upload-artifact@v4
5046
id: docs-upload
5147
with:
5248
name: docs
53-
path: doc/
54-
55-
# Test Elixir
56-
- run: mix format --check-formatted
57-
- run: mix deps.unlock --check-unused
58-
- run: mix compile --force --warnings-as-errors
59-
- run: mix test
60-
- run: test/prerelease.sh
49+
path: test/tmp/contents/doc/
6150

6251
# Test JS
6352
- run: npm run lint --prefix assets
@@ -88,6 +77,10 @@ jobs:
8877
# Test Erlang without -doc attribute support
8978
- elixir: "1.16"
9079
otp: "26"
80+
# Test Erlang with -doc attribute support
81+
- elixir: "1.17"
82+
otp: "27"
83+
lint: true
9184
steps:
9285
- uses: actions/checkout@v3
9386

@@ -97,5 +90,14 @@ jobs:
9790
elixir-version: ${{ matrix.elixir }}
9891

9992
- run: mix deps.get
93+
94+
- run: mix compile --warnings-as-errors
95+
if: ${{ matrix.lint }}
96+
10097
- run: mix test
101-
- run: test/prerelease.sh
98+
99+
- run: mix deps.unlock --check-unused
100+
if: ${{ matrix.lint }}
101+
102+
- run: mix format --check-formatted
103+
if: ${{ matrix.lint }}

test/prerelease.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
PKG=test/tmp/package
2+
PKG=test/tmp
33

44
# build package
55
mix hex.build
@@ -10,4 +10,8 @@ TAR=$(ls ex_doc-*.tar | head -n 1)
1010
rm -rf $PKG && mkdir -p $PKG/contents && tar xf $TAR -C $PKG && tar xzf $PKG/contents.tar.gz -C $PKG/contents
1111

1212
# compile and build docs
13-
cd $PKG/contents && MIX_ENV=prod mix do deps.get --only prod, compile, docs
13+
cd $PKG/contents && MIX_ENV=prod mix do deps.get --only prod + compile + docs
14+
15+
# run assertions
16+
test -f doc/index.html || echo "doc/index.html missing"
17+
test -f doc/ExDoc.epub || echo "doc/ExDoc.epub missing"

0 commit comments

Comments
 (0)