Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
}

const pullNumber = context.payload.workflow_run.pull_requests[0].number;
const artifactUrl = artifacts.data.artifacts[0].archive_download_url;
const artifactId = artifacts.data.artifacts[0].id;
const artifactUrl = `${context.payload.workflow_run.artifacts_url}/${artifactId}`;
const commentBody = `<!-- build-artifact-comment -->\n📦 Docs artifacts are ready: ${artifactUrl}`;

const comments = await github.rest.issues.listComments({
Expand Down
34 changes: 18 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
MIX_ENV: test

jobs:
elixir_js_and_lint:
assets:
runs-on: ubuntu-20.04
strategy:
matrix:
Expand All @@ -29,35 +29,24 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('asssets/package-lock.json') }}

- run: npm ci --prefix assets
- run: npm run build --prefix assets

# Setup Elixir
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}

- run: mix deps.get

# Generate and upload artifacts
- name: Generate docs
run: |
mix build
test -f doc/index.html && echo "doc/index.html exists."
test -f doc/ExDoc.epub && echo "doc/ExDoc.epub exists."
run: test/prerelease.sh

- name: Upload docs
uses: actions/upload-artifact@v4
id: docs-upload
with:
name: docs
path: doc/

# Test Elixir
- run: mix format --check-formatted
- run: mix deps.unlock --check-unused
- run: mix compile --force --warnings-as-errors
- run: mix test
- run: test/prerelease.sh
path: test/tmp/contents/doc/

# Test JS
- run: npm run lint --prefix assets
Expand Down Expand Up @@ -88,6 +77,10 @@ jobs:
# Test Erlang without -doc attribute support
- elixir: "1.16"
otp: "26"
# Test Erlang with -doc attribute support
- elixir: "1.17"
otp: "27"
lint: true
steps:
- uses: actions/checkout@v3

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

- run: mix deps.get

- run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}

- run: mix test
- run: test/prerelease.sh

- run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}

- run: mix format --check-formatted
if: ${{ matrix.lint }}
8 changes: 6 additions & 2 deletions test/prerelease.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
PKG=test/tmp/package
PKG=test/tmp

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

# compile and build docs
cd $PKG/contents && MIX_ENV=prod mix do deps.get --only prod, compile, docs
cd $PKG/contents && MIX_ENV=prod mix do deps.get --only prod + compile + docs

# run assertions
test -f doc/index.html || echo "doc/index.html missing"
test -f doc/ExDoc.epub || echo "doc/ExDoc.epub missing"