Add GitHub action to publish to Hex #391
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: | |
branches: | |
- main | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
MIX_ENV: test | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
otp: ["25.3"] | |
elixir: ["1.14"] | |
steps: | |
- name: Clone the repository | |
uses: actions/checkout@v2 | |
- name: Install OTP and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Install and compile dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: mix do deps.get --only test, deps.compile | |
- name: Check formatting | |
run: mix format --check-formatted | |
- name: Check no unused dependencies | |
run: mix do deps.get, deps.unlock --check-unused | |
if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} | |
- name: Compile with --warnings-as-errors | |
run: mix compile --warnings-as-errors --force | |
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones | |
# Cache key based on Elixir & Erlang version (also useful when running in matrix) | |
- name: Cache Dialyzer's PLT | |
uses: actions/cache@v2 | |
id: cache-plt | |
with: | |
path: priv/plts | |
key: ${{ runner.os }}-otp${{ matrix.otp }}-elixir${{ matrix.elixir }} | |
# Create PLTs if no cache was found | |
- name: Create PLTs | |
if: steps.cache-plt.outputs.cache-hit != 'true' | |
run: mix dialyzer --plt | |
- name: Run Dialyzer | |
run: mix dialyzer --format github | |
test: | |
name: Test (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }}, C* ${{ matrix.cassandra_version }}, Native protocols ${{ matrix.cassandra_native_protocols }}) | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- otp: "25.3" | |
elixir: "1.14" | |
cassandra_version: "4.1" | |
cassandra_native_protocols: "v4,v5" | |
lint: true | |
- otp: "25.3" | |
elixir: "1.14" | |
cassandra_version: "3" | |
cassandra_native_protocols: "v3,v4" | |
# Oldest supported Elixir/OTP matrix. We support down to Erlang 21, but | |
# rustler_precompiled (which we use for nimble_lz4, which we use for testing) | |
# requires OTP 23+. | |
- otp: "23.3" | |
elixir: "1.11" | |
cassandra_version: "3" | |
cassandra_native_protocols: "v3" | |
env: | |
CASSANDRA_VERSION: ${{ matrix.cassandra_version }} | |
steps: | |
- name: Clone the repository | |
uses: actions/checkout@v2 | |
- name: Start Docker and wait for it to be up | |
run: | | |
docker-compose up --detach --build | |
./test/docker/health-check-services.sh | |
- name: Install OTP and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{matrix.otp}} | |
elixir-version: ${{matrix.elixir}} | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-mix-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Install and compile dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
mix deps.get --only test | |
mix deps.compile | |
# TODO: eventually figure out why we can't run encryption tests on CI. | |
- name: Run tests | |
run: mix test.native_protocols --only-protocols ${{ matrix.cassandra_native_protocols }} --trace --exclude encryption | |
- name: Dump Docker logs on failure | |
uses: jwalton/gh-docker-logs@v1 | |
if: failure() | |
test_clustering: | |
name: Test C* Clustering (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }}, C* ${{ matrix.cassandra_version }}, Native protocol ${{ matrix.cassandra_native_protocol }}) | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- otp: "24.2" | |
elixir: "1.13" | |
cassandra_version: "4.1" | |
cassandra_native_protocol: "v5" | |
lint: true | |
- otp: "24.2" | |
elixir: "1.13" | |
cassandra_version: "4.1" | |
cassandra_native_protocol: "v4" | |
- otp: "24.2" | |
elixir: "1.13" | |
cassandra_version: "3" | |
cassandra_native_protocol: "v3" | |
- otp: "24.2" | |
elixir: "1.13" | |
cassandra_version: "3" | |
cassandra_native_protocol: "v4" | |
# Oldest supported Elixir/OTP matrix. We support down to Erlang 21, but | |
# rustler_precompiled (which we use for nimble_lz4, which we use for testing) | |
# requires OTP 23+. | |
- otp: "23.3" | |
elixir: "1.11" | |
cassandra_version: "3" | |
cassandra_native_protocol: "v3" | |
env: | |
CASSANDRA_VERSION: ${{ matrix.cassandra_version }} | |
CASSANDRA_NATIVE_PROTOCOL: ${{ matrix.cassandra_native_protocol }} | |
NIMBLELZ4_FORCE_BUILD: ${{ matrix.elixir == '1.9' && 'true' }} | |
steps: | |
- name: Clone the repository | |
uses: actions/checkout@v2 | |
- name: Start Docker and wait for it to be up | |
run: | | |
docker-compose up --detach --build | |
./test/docker/health-check-services.sh | |
- name: Install OTP and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{matrix.otp}} | |
elixir-version: ${{matrix.elixir}} | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Install and compile dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
mix deps.get --only test | |
mix deps.compile | |
- name: Run clustering end-to-end tests | |
run: mix test.clustering | |
- name: Dump Docker logs on failure | |
uses: jwalton/gh-docker-logs@v1 | |
if: failure() | |
test_scylla: | |
name: Test ScyllaDB (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }}, Scylla ${{ matrix.scylla_version }}, Native protocol ${{ matrix.cassandra_native_protocol }}) | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- otp: "24.2" | |
elixir: "1.13" | |
scylla_version: "5.1.6" | |
cassandra_native_protocol: "v4" | |
- otp: "24.2" | |
elixir: "1.13" | |
scylla_version: "4.6.3" | |
cassandra_native_protocol: "v4" | |
- otp: "24.2" | |
elixir: "1.13" | |
scylla_version: "2.3.1" | |
cassandra_native_protocol: "v4" | |
- otp: "24.2" | |
elixir: "1.13" | |
scylla_version: "2.3.1" | |
cassandra_native_protocol: "v3" | |
env: | |
SCYLLA_VERSION: ${{ matrix.scylla_version }} | |
CASSANDRA_NATIVE_PROTOCOL: ${{ matrix.cassandra_native_protocol }} | |
steps: | |
- name: Clone the repository | |
uses: actions/checkout@v2 | |
- name: Start Docker and wait for it to be up | |
run: | | |
docker-compose --file docker-compose.scylladb.yml up --detach | |
./test/docker/health-check-services.sh | |
- name: Install OTP and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{matrix.otp}} | |
elixir-version: ${{matrix.elixir}} | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-mix-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Install and compile dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
mix deps.get --only test | |
mix deps.compile | |
- name: Run tests | |
run: mix test.scylladb | |
- name: Dump Docker logs on failure | |
uses: jwalton/gh-docker-logs@v1 | |
if: failure() |