Attach metadata to artifacts (#2005) #2055
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [pull_request, push] | |
env: | |
MIX_ENV: test | |
jobs: | |
assets: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- elixir: "1.17" | |
otp: "27" | |
node: 18.x | |
steps: | |
- uses: actions/checkout@v3 | |
# Setup Node | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{matrix.node}} | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
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 }} | |
# Generate and upload artifacts | |
- name: Generate docs | |
run: test/prerelease.sh | |
- name: Attach docs metadata | |
run: | | |
echo "{\"number\":${{ github.event.number }}}" > test/tmp/contents/doc/gh.json | |
- name: Upload docs | |
uses: actions/upload-artifact@v4 | |
id: docs-upload | |
with: | |
name: docs | |
path: test/tmp/contents/doc/ | |
# Test JS | |
- run: npm run lint --prefix assets | |
- name: npm run test --prefix assets | |
run: | | |
sudo apt-get install xvfb | |
xvfb-run --auto-servernum npm run test --prefix assets | |
env: | |
CI: true | |
# Push updated assets if all good | |
- name: Push updated assets | |
if: github.ref_name == 'main' | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update assets | |
file_pattern: formatters | |
elixir: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Test very old Elixir and Erlang | |
- elixir: "1.14" | |
otp: "25" | |
# 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 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- run: mix deps.get | |
- run: mix compile --warnings-as-errors | |
if: ${{ matrix.lint }} | |
- run: mix test | |
- run: mix deps.unlock --check-unused | |
if: ${{ matrix.lint }} | |
- run: mix format --check-formatted | |
if: ${{ matrix.lint }} |