CI/CD #162
This file contains hidden or 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/CD | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ['main', 'release/**'] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: ['main', 'release/**'] | |
| schedule: | |
| - cron: '23 4 * * *' | |
| jobs: | |
| test: | |
| name: Erlang ${{ matrix.otp }} (rebar3 ${{ matrix.rebar3 }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # OTP 28 with latest rebar3 | |
| - otp: '28' | |
| rebar3: '3.25.0' | |
| coverage: true | |
| # OTP 27 with latest rebar3 | |
| - otp: '27' | |
| rebar3: '3.25.0' | |
| # OTP 26 with rebar3 3.25 | |
| - otp: '26' | |
| rebar3: '3.25.0' | |
| # OTP 25 with rebar3 3.22 | |
| - otp: '25' | |
| rebar3: '3.22.0' | |
| # OTP 24 with rebar3 3.22 (minimum supported) | |
| - otp: '24' | |
| rebar3: '3.22.0' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Erlang/OTP | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ matrix.otp }} | |
| rebar3-version: ${{ matrix.rebar3 }} | |
| - name: Cache Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| _build | |
| ~/.cache/rebar3 | |
| key: ${{ runner.os }}-otp${{ matrix.otp }}-${{ hashFiles('rebar.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-otp${{ matrix.otp }}- | |
| - name: Compile | |
| run: rebar3 compile | |
| #- name: Run xref | |
| # run: rebar3 xref | |
| #- name: Run dialyzer | |
| # run: rebar3 dialyzer | |
| # continue-on-error: true # Don't fail on dialyzer warnings initially | |
| - name: Run tests | |
| run: rebar3 ct | |
| - name: Generate coverage | |
| if: matrix.coverage | |
| run: rebar3 coverage | |
| - name: Upload coverage to Codecov | |
| if: matrix.coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: _build/test/cover/ct.coverdata | |
| flags: unittests | |
| name: OTP-${{ matrix.otp }} | |
| template-checks: | |
| name: Template Checks | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: '27' | |
| rebar3-version: '3.25.0' | |
| - name: Get Supported 'new' Templates | |
| run: make test-new | |
| - name: Check New LFE Library Project | |
| run: make test-new-lfe-lib | |
| - name: Check New LFE Main Project | |
| run: make test-new-lfe-main | |
| - name: Check New LFE/OTP Application Project | |
| run: make test-new-lfe-app | |
| - name: Check New LFE escript Project | |
| run: make test-new-lfe-escript | |
| - name: Check New LFE/OTP Release Project | |
| run: make test-new-lfe-release | |
| - name: Check versions Command Output | |
| run: make test-versions-cmd | |
| - name: Check clean Command | |
| run: make test-clean-cmd | |
| integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Erlang/OTP | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: '27' | |
| rebar3-version: '3.25.0' | |
| - name: Run integration tests | |
| run: | | |
| rebar3 compile | |
| rebar3 ct | |
| publish: | |
| name: Publish to Hex | |
| runs-on: ubuntu-latest | |
| needs: [test, integration] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Erlang/OTP | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: '27' | |
| rebar3-version: '3.25.0' | |
| - name: Publish to Hex | |
| env: | |
| HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | |
| run: rebar3 hex publish --yes |