aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml75
-rw-r--r--plugins/hex.mk2
-rw-r--r--test/plugin_hex.mk12
3 files changed, 83 insertions, 6 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 4217ffc..850f8cb 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -50,7 +50,6 @@ jobs:
- erlydtl
- escript
- eunit
- - hex
- proper
- protobuffs
# Trick GH runners into picking this slower job early.
@@ -112,6 +111,80 @@ jobs:
path: |
test/test_*/
+ check-hex:
+ strategy:
+ fail-fast: false
+ matrix:
+ erlang:
+ - '27'
+ os:
+# - macos-latest
+ - ubuntu-latest
+# - windows-latest
+ extra: ['', 'CACHE_DEPS=1', 'LEGACY=1']
+
+ services:
+ postgres:
+ image: postgres:14
+ env:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres
+ POSTGRES_DB: postgres
+ ports:
+ - 5432:5432
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
+ runs-on: ${{ matrix.os }}
+ steps:
+
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Install Erlang/OTP and Elixir
+ uses: erlef/setup-beam@v1
+ with:
+ otp-version: ${{ matrix.erlang }}
+ elixir-version: 1.17
+ version-type: loose
+
+ - name: Setup MSYS2 (Windows)
+ if: matrix.os == 'windows-latest'
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: mingw64
+ release: false
+ update: true
+ install: >-
+ git
+ make
+ mingw-w64-x86_64-gcc
+ gnu-netcat
+ diffutils
+
+ - name: Setup local Hexpm
+ run: |
+ git clone https://github.com/hexpm/hexpm
+ cd hexpm
+ perl -ni.bak -e 'print;if ($.==3) {print " user_confirm: false,\n"}' config/dev.exs
+ mix setup
+ mix phx.server &
+
+ - name: Run tests (Linux)
+ if: matrix.os == 'ubuntu-latest'
+ run: make check c=hex -j4 -k ${{ matrix.extra }}
+
+ - name: Run tests (Windows)
+ if: matrix.os == 'windows-latest'
+ shell: msys2 {0}
+ run: PATH=$INSTALL_DIR_FOR_OTP/bin:$PATH make check c=hex -j4 -k ${{ matrix.extra }}
+
+ - name: Upload artifacts
+ if: failure()
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ matrix.os }} OTP-${{ matrix.erlang }} ${{ matrix.suite }} ${{ matrix.extra }}
+ path: |
+ test/test_*/
+
packages:
strategy:
fail-fast: false
diff --git a/plugins/hex.mk b/plugins/hex.mk
index e7c58ef..44beb65 100644
--- a/plugins/hex.mk
+++ b/plugins/hex.mk
@@ -71,7 +71,7 @@ HEX_TARBALL_FILES ?= \
$(sort $(call core_find,priv/,*)) \
$(wildcard README*) \
$(wildcard rebar.config) \
- $(sort $(call core_find,src/,*))
+ $(sort $(if $(LEGACY),$(filter-out src/$(PROJECT).app.src,$(call core_find,src/,*)),$(call core_find,src/,*)))
HEX_TARBALL_OUTPUT_FILE ?= $(ERLANG_MK_TMP)/$(PROJECT).tar
diff --git a/test/plugin_hex.mk b/test/plugin_hex.mk
index 88ee259..99e6356 100644
--- a/test/plugin_hex.mk
+++ b/test/plugin_hex.mk
@@ -140,7 +140,7 @@ hex-tarball-create-with-deps: init
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add Cowlib to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.10.1\n"}' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.13.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowlib to the applications key in the .app.src file"
@@ -159,7 +159,7 @@ endif
{_, [{<<\"cowlib\">>, Cowlib}]} = lists:keyfind(<<\"requirements\">>, 1, Metadata), \
{_, <<\"cowlib\">>} = lists:keyfind(<<\"app\">>, 1, Cowlib), \
{_, false} = lists:keyfind(<<\"optional\">>, 1, Cowlib), \
- {_, <<\"2.10.1\">>} = lists:keyfind(<<\"requirement\">>, 1, Cowlib), \
+ {_, <<\"2.13.0\">>} = lists:keyfind(<<\"requirement\">>, 1, Cowlib), \
halt(0)"
hex-release-publish: init
@@ -187,6 +187,8 @@ hex-release-publish: init
$i "Check that the release exists"
$t curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 >/dev/null
+# @todo There's a weird ci.erlang.mk related bug with CACHE_DEPS. Fix it.
+ifndef CACHE_DEPS
hex-release-publish-with-deps: init
$i "Bootstrap a new OTP application named $(APP)"
@@ -195,7 +197,7 @@ hex-release-publish-with-deps: init
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add Cowlib to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.10.1\n"}' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.13.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowlib to the applications key in the .app.src file"
@@ -221,13 +223,15 @@ endif
$t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
$i "Publish the Cowlib release"
- $t $(MAKE) -C $(APP)/deps/cowlib hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
+ $t cp ../erlang.mk $(APP)/deps/cowlib
+ $t $(MAKE) -C $(APP)/deps/cowlib hex-release-publish DEPS_DIR=$(APP)/deps ERLANG_MK_TMP=$(APP)/.erlang.mk HEX_SECRET=`cat $(APP)/hex.key` $v
$i "Publish the release"
$t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
$i "Check that the release exists and includes Cowlib as requirement"
$t curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 | grep -q cowlib
+endif
hex-release-replace: init