diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index 221bdad86..d7555ea73 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -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 = `\n📦 Docs artifacts are ready: ${artifactUrl}`; const comments = await github.rest.issues.listComments({ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f915454a..d3be1216f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ env: MIX_ENV: test jobs: - elixir_js_and_lint: + assets: runs-on: ubuntu-20.04 strategy: matrix: @@ -29,6 +29,7 @@ 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 @@ -36,28 +37,16 @@ jobs: 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 @@ -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 @@ -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 }} diff --git a/test/prerelease.sh b/test/prerelease.sh index f1e95ba1e..ac0113fc6 100755 --- a/test/prerelease.sh +++ b/test/prerelease.sh @@ -1,5 +1,5 @@ #!/bin/bash -PKG=test/tmp/package +PKG=test/tmp # build package mix hex.build @@ -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"