summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 9bf715fada877bd3d1d929070e446f6d30f44817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CI

on: [pull_request, push]

env:
  ELIXIR_ASSERT_TIMEOUT: 2000
  ELIXIRC_OPTS: "--warnings-as-errors"
  ERLC_OPTS: "warnings_as_errors"
  LANG: C.UTF-8

permissions:
  contents: read

jobs:
  test_linux:
    name: Linux, ${{ matrix.otp_release }}, Ubuntu 18.04
    strategy:
      fail-fast: false
      matrix:
        include:
          - otp_release: OTP-25.0
            otp_latest: true
          - otp_release: OTP-24.3
          - otp_release: OTP-24.0
          - otp_release: OTP-23.3
          - otp_release: OTP-23.0
          - otp_release: master
            development: true
          - otp_release: maint
            development: true
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 50
      - name: Install Erlang/OTP
        run: |
          cd $RUNNER_TEMP
          wget -O otp.tar.gz https://repo.hex.pm/builds/otp/ubuntu-18.04/${{ matrix.otp_release }}.tar.gz
          mkdir -p otp
          tar zxf otp.tar.gz -C otp --strip-components=1
          otp/Install -minimal $(pwd)/otp
          echo "$(pwd)/otp/bin" >> $GITHUB_PATH
      - name: Compile Elixir
        run: |
          rm -rf .git
          make compile
          echo "$PWD/bin" >> $GITHUB_PATH
      - name: Build info
        run: bin/elixir --version
      - name: Check format
        run: make test_formatted && echo "All Elixir source code files are properly formatted."
      - name: Run Dialyzer
        run: dialyzer -pa lib/elixir/ebin --build_plt --output_plt elixir.plt --apps lib/elixir/ebin/elixir.beam lib/elixir/ebin/Elixir.Kernel.beam
      - name: Erlang test suite
        run: make test_erlang
        continue-on-error: ${{ matrix.development }}
      - name: Elixir test suite
        run: make test_elixir
        continue-on-error: ${{ matrix.development }}
      - name: Check reproducible builds
        run: taskset 1 make check_reproducible
        if: ${{ matrix.otp_latest }}
      - name: Build docs
        if: ${{ matrix.otp_latest }}
        run: |
          git config --global advice.detachedHead false
          EX_DOC_LATEST_STABLE_VERSION=$(curl -s https://hex.pm/api/packages/ex_doc | jq --raw-output '.latest_stable_version')
          for branch in main v${EX_DOC_LATEST_STABLE_VERSION}; do
            echo "Building docs with ExDoc ${branch}"
            cd ..
            git clone https://github.com/elixir-lang/ex_doc.git --branch ${branch} --depth 1
            cd ex_doc
            ../elixir/bin/mix do local.rebar --force + local.hex --force + deps.get + compile
            cd ../elixir/
            make docs
            rm -rf ../ex_doc/
          done

  test_windows:
    name: Windows, OTP-${{ matrix.otp_release }}, Windows Server 2019
    strategy:
      matrix:
        otp_release: ['23.3']
    runs-on: windows-2019
    steps:
      - name: Configure Git
        run: git config --global core.autocrlf input
      - uses: actions/checkout@v2
        with:
          fetch-depth: 50
      - name: Cache Erlang/OTP package
        uses: actions/cache@v2
        with:
          path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey\erlang
          key: OTP-${{ matrix.otp_release }}-windows-2019
      - name: Install Erlang/OTP
        run: choco install -y erlang --version ${{ matrix.otp_release }}
      - name: Compile Elixir
        run: |
          remove-item '.git' -recurse -force
          make compile
      - name: Build info
        run: bin/elixir --version
      - name: Check format
        run: make test_formatted && echo "All Elixir source code files are properly formatted."
      - name: Erlang test suite
        run: make --keep-going test_erlang
      - name: Elixir test suite
        run: |
          del c:/Windows/System32/drivers/etc/hosts
          make --keep-going test_elixir

  check_posix_compliant:
    name: Check POSIX-compliant
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 50
      - name: Install Shellcheck
        run: |
          sudo apt update
          sudo apt install -y shellcheck
      - name: Check POSIX-compliant
        run: |
          shellcheck -e SC2039,2086 bin/elixir && echo "bin/elixir is POSIX compliant"
          shellcheck bin/elixirc && echo "bin/elixirc is POSIX compliant"
          shellcheck bin/iex && echo "bin/iex is POSIX compliant"