diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..44ac7bc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish + +on: + push: + tags: [ 'v*.*.*' ] + branches: master + +env: + OTP_VERSION_SPEC: "21.1" + ELIXIR_VERSION_SPEC: "1.9.4" + +jobs: + test: + uses: ./.github/workflows/test.yml + publish: + needs: test + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ env.OTP_VERSION_SPEC }} + elixir-version: ${{ env.ELIXIR_VERSION_SPEC }} + + # https://hex.pm/docs/publish + - name: Publish + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + run: | + mix deps.get + mix hex.publish --yes \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..eb9b15c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: Test + +on: [push, workflow_call] + +env: + OTP_VERSION_SPEC: "21.1" + ELIXIR_VERSION_SPEC: "1.9.4" + MIX_ENV: test + PGUSER: postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + +jobs: + test: + runs-on: ubuntu-20.04 + services: + postgres: + env: + POSTGRES_HOST_AUTH_METHOD: trust + image: postgres:9.5 + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready --health-interval 10s + --health-timeout 5s --health-retries 5 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ env.OTP_VERSION_SPEC }} + elixir-version: ${{ env.ELIXIR_VERSION_SPEC }} + + - name: Run Tests + run: | + mix deps.get + cp config/test.exs.GH_actions config/test.exs + mix ecto.create + mix test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 37320f3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: elixir -dist: zenial -elixir: - - 1.9.4 -otp_release: - - 21.1 -addons: - postgresql: '9.5' -services: - - postgresql -before_script: - - cp config/test.exs.travis config/test.exs - - MIX_ENV=test mix ecto.create -script: - - MIX_ENV=test mix test -deploy: - skip_cleanup: true - provider: script - script: mix hex.publish --yes - on: - tags: true diff --git a/config/test.exs.travis b/config/test.exs.GH_actions similarity index 92% rename from config/test.exs.travis rename to config/test.exs.GH_actions index c5464c6..27f9ce5 100644 --- a/config/test.exs.travis +++ b/config/test.exs.GH_actions @@ -6,6 +6,7 @@ config :ecto_soft_delete, Ecto.SoftDelete.Test.Repo, database: "soft_delete_test", hostname: "localhost", port: 5432, + username: "postgres", adapter: Ecto.Adapters.Postgres, pool: Ecto.Adapters.SQL.Sandbox, types: EctoSoftDelete.PostgresTypes