From c694a381c6a44d70f23e16b13a16a178e89e7888 Mon Sep 17 00:00:00 2001 From: Alexander Turenko Date: Fri, 8 Apr 2022 23:26:53 +0300 Subject: [PATCH 1/4] rockspec: add forgotten graphql/init.lua Follows up #29 --- graphql-scm-1.rockspec | 1 + 1 file changed, 1 insertion(+) diff --git a/graphql-scm-1.rockspec b/graphql-scm-1.rockspec index 4e6cec9..6388c79 100644 --- a/graphql-scm-1.rockspec +++ b/graphql-scm-1.rockspec @@ -20,6 +20,7 @@ dependencies = { build = { type = 'builtin', modules = { + ['graphql.init'] = 'graphql/init.lua', ['graphql.execute'] = 'graphql/execute.lua', ['graphql.introspection'] = 'graphql/introspection.lua', ['graphql.parse'] = 'graphql/parse.lua', From bd3319f612bc0f9fd14a8c5050875196c551d7cc Mon Sep 17 00:00:00 2001 From: Alexander Turenko Date: Sat, 9 Apr 2022 00:51:19 +0300 Subject: [PATCH 2/4] ci: upload .all.rock instead of .src.rock There are two reasons: * The module is written purely in Lua (without Lua/C parts) and nothing blocks us from deliver .all.rock. There is no much difference for this module, but .src.rock is usually something to compile before installation. See [1] for details. * We can't write a version into the `graphql/init.lua` file for .src.rock. Steps to illustrate what does not work with .src.rock: * Step into the git repository. * Rewrite `graphql/init.lua`. * `tarantoolctl rocks new_version --tag $TAG` - Creates a rockspec with `source.tag = $TAG`. * `tarantoolctl rocks pack graphql-$TAG-1.rockspec` - Downloads a fresh (unmodified) source from the git tag. - Packs the unmodified sources into .src.rock. The steps differ, when we're pack into .all.rock: * <...> * `tarantoolctl rocks make graphql-$TAG-1.rockspec` - Installs the modified content of the git repository into `.rocks`. * `tarantoolctl rocks pack graphql $TAG` - Packs the modified content from `.rocks` into .all.rock. [1]: https://github.com/luarocks/luarocks/wiki/Types-of-rocks Follows up #29 --- .github/workflows/publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b6d2ac8..1d17996 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,11 +18,12 @@ jobs: - run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV - run: echo "return { VERSION = '"$TAG"-1' }" > graphql/init.lua - run: tarantoolctl rocks new_version --tag $TAG - - run: tarantoolctl rocks pack graphql-$TAG-1.rockspec + - run: tarantoolctl rocks make graphql-$TAG-1.rockspec + - run: tarantoolctl rocks pack graphql $TAG - uses: tarantool/rocks.tarantool.org/github-action@master with: auth: ${{ secrets.ROCKS_AUTH }} files: | graphql-${{ env.TAG }}-1.rockspec - graphql-${{ env.TAG }}-1.src.rock \ No newline at end of file + graphql-${{ env.TAG }}-1.all.rock From 30636ea0c1c6b72fe76b4e2a94b25d7d8763163d Mon Sep 17 00:00:00 2001 From: Alexander Turenko Date: Sat, 9 Apr 2022 01:14:53 +0300 Subject: [PATCH 3/4] Drop a rockspec revision from graphql.VERSION I guess it should ease scripting around the version string. Also changed `'scm-1'` to `'unknown'`, because we actually don't know a way how the module is installed: loaded from a local git clone, extracted from a release .zip archive generated by GitHub or actually installed from the scm-1 rockspec. In all those variants `graphql.VERSION` will return the same predefined string. Modified the test to make it independent of a module installation variant. I don't meet any real problem here, it just looks more durable. Follows up #29 --- .github/workflows/publish.yml | 2 +- graphql/init.lua | 2 +- test/unit/graphql_test.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1d17996..db0aac9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: tarantool-version: '2.8' - run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV - - run: echo "return { VERSION = '"$TAG"-1' }" > graphql/init.lua + - run: echo "return {VERSION = '"$TAG"'}" > graphql/init.lua - run: tarantoolctl rocks new_version --tag $TAG - run: tarantoolctl rocks make graphql-$TAG-1.rockspec - run: tarantoolctl rocks pack graphql $TAG diff --git a/graphql/init.lua b/graphql/init.lua index 1a82ec2..4b53717 100644 --- a/graphql/init.lua +++ b/graphql/init.lua @@ -1 +1 @@ -return { VERSION = 'scm-1' } \ No newline at end of file +return {VERSION = 'unknown'} diff --git a/test/unit/graphql_test.lua b/test/unit/graphql_test.lua index 6ba0b15..c6d9f2b 100644 --- a/test/unit/graphql_test.lua +++ b/test/unit/graphql_test.lua @@ -1090,5 +1090,5 @@ function g.test_util_find_by_name() end g.test_version = function() - t.assert_equals(require('graphql').VERSION, 'scm-1') + t.assert_type(require('graphql').VERSION, 'string') end From a28b920534a5a667f50617a95b07045da3acb7bf Mon Sep 17 00:00:00 2001 From: Alexander Turenko Date: Sat, 9 Apr 2022 01:32:35 +0300 Subject: [PATCH 4/4] ci: upload scm-1 rockspec from CI Before this change I had to manually upload a new scm-1 rockpec to the rocks server after pushing an update to the git repository. Now it is automated. Follows up #29 --- .github/workflows/publish.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index db0aac9..eefce58 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,11 +2,21 @@ name: Publish on: push: - tags: - - '*' + branches: [master] + tags: ['*'] jobs: - publish: + publish-rockspec-scm-1: + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: tarantool/rocks.tarantool.org/github-action@master + with: + auth: ${{ secrets.ROCKS_AUTH }} + files: graphql-scm-1.rockspec + + publish-rockspec-tag: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-20.04 steps: