diff --git a/.travis/.gitignore b/.github/.gitignore similarity index 100% rename from .travis/.gitignore rename to .github/.gitignore diff --git a/.travis/Dockerfile b/.github/Dockerfile similarity index 100% rename from .travis/Dockerfile rename to .github/Dockerfile diff --git a/.travis/Makefile b/.github/Makefile similarity index 98% rename from .travis/Makefile rename to .github/Makefile index fd73b49..8b2dbbd 100644 --- a/.travis/Makefile +++ b/.github/Makefile @@ -60,7 +60,7 @@ build: # Setup a build environment @$(DOCKER) build -t $(MODULE):build . @$(DOCKER) run --rm -v $(shell pwd)/..:/build $(MODULE):build bash -c \ - 'make -C /build/.travis build-module' + 'make -C /build/.github build-module' build-module: clean install .find-deps # Build $(MODULE) module from source diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..736610b --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,2 @@ +tag-template: $NEXT_MINOR_VERSION +template: $CHANGES diff --git a/.travis/ubuntu.patch b/.github/ubuntu.patch similarity index 100% rename from .travis/ubuntu.patch rename to .github/ubuntu.patch diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..27f9972 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,33 @@ +name: Package +on: + release: + types: [published] + +concurrency: + group: '${{ github.event_name }}' + cancel-in-progress: false + +jobs: + package: + name: Build the module package + runs-on: ubuntu-20.04 + timeout-minutes: 10 + steps: + - name: Prepare the virtual environment + uses: hausgold/actions/ci@master + with: + clone_token: '${{ secrets.CLONE_TOKEN }}' + settings: '${{ github.repository }}' + target: ci/docker + - uses: actions/checkout@v2 + + - name: Configure the module version + run: var MOD_VERSION ${APP_REF} + + - name: Build the module + run: make -C .github build package + + - name: Upload built module package + run: > + release-asset '${{ github.event.release.id }}' + ".github/ejabberd-unread-${MOD_VERSION}.tar.gz" diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml new file mode 100644 index 0000000..ade9840 --- /dev/null +++ b/.github/workflows/process.yml @@ -0,0 +1,17 @@ +name: Process + +on: + push: + branches: + - main + - master + +jobs: + release_drafter: + name: Update release draft + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..183de60 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,50 @@ +name: Test +on: + push: + branches: + - '**' + schedule: + - cron: '0 0 * * MON' + +concurrency: + group: '${{ github.ref }}' + cancel-in-progress: true + +jobs: + test: + name: Test the module + runs-on: ubuntu-20.04 + timeout-minutes: 5 + steps: + - name: Prepare the virtual environment + uses: hausgold/actions/ci@master + with: + clone_token: '${{ secrets.CLONE_TOKEN }}' + settings: '${{ github.repository }}' + target: ci/docker + - uses: actions/checkout@v2 + + - name: Install the module dependencies + run: make install + + - name: Start the module dependencies + run: START=background make start reload + + - name: Run the module tests + run: make test + + build: + name: Build the module + runs-on: ubuntu-20.04 + timeout-minutes: 5 + steps: + - name: Prepare the virtual environment + uses: hausgold/actions/ci@master + with: + clone_token: '${{ secrets.CLONE_TOKEN }}' + settings: '${{ github.repository }}' + target: ci/docker + - uses: actions/checkout@v2 + + - name: Build the module + run: make -C .github build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4cd7766..0000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -sudo: true -dist: bionic - -cache: - directories: - - tests/node_modules - -stages: - # We want to build and test each and every branch. - - name: build - - name: test - # We just run the release stage, when we have a tag build. - - name: release - if: tag =~ .* AND type IN (push, api) - -jobs: - include: - - stage: build - install: skip - script: - # Reown the build workspace to the travis user (due to Docker, - # and caching) - - sudo chown travis:travis -R $PWD/.. - # Build the ejabberd module - - make -C .travis build - - - stage: test - install: - # Install docker-compose version 1.22.0 - - sudo rm /usr/local/bin/docker-compose - - curl -L http://bit.ly/2B4msDT > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - # Fix some travis/2000 common/1000 user id mapping issues - - source .travis/exe/docker-glue - # Install the test suite dependencies - - make install - script: - - docker --version - - docker-compose --version - - START=background TEST_ENV=ci make start reload test - - - stage: release - install: skip - script: - # Reown the build workspace to the travis user (due to Docker, - # and caching) - - sudo chown travis:travis -R $PWD/.. - # Setup the module version environment variable for the release - - export MOD_VERSION=${TRAVIS_TAG} - - \[ -n "${MOD_VERSION}" \] || export MOD_VERSION=latest - # Build and package the ejabberd module - - make -C .travis build package - deploy: - provider: releases - api_key: ${GITHUB_AUTH_TOKEN} - file: .travis/ejabberd-unread-${MOD_VERSION}.tar.gz - skip_cleanup: true - on: - tags: true diff --git a/.travis/exe/docker-glue b/.travis/exe/docker-glue deleted file mode 100755 index c505a35..0000000 --- a/.travis/exe/docker-glue +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -# Add a new glue user with the uid 1000 and add him to the docker and travis -# group. Then add the travis user to the glue group and reload the glue group -# on the current shell session. Then re-own the whole build directory to the -# glue user and group. -# -# @author Hermann Mayer - -# Setup the glue user -sudo useradd -m -u 1000 -G travis,docker glue -sudo usermod -aG glue travis - -# Reown the build workspace to the glue user -sudo chown glue:travis -R $PWD/.. - -# Ensure correct permissions on the SSH files -sudo chmod 600 ~/.ssh/config diff --git a/CHANGELOG.md b/CHANGELOG.md index 103256a..d97efe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## next + +* Migrated from Travis CI to Github Actions (#6) + ## 1.0.4 * Improved the MAM result manipulation to directly change the XML elements diff --git a/LICENSE b/LICENSE index 6bf41d0..e56fa2c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 HAUSGOLD +Copyright (c) 2021 HAUSGOLD | talocasa GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 26410ec..48b1521 100644 --- a/Makefile +++ b/Makefile @@ -136,19 +136,19 @@ COMPOSE := $(COMPOSE) -p $(PROJECT_NAME) @$(eval BASH_RUN_SHELL_CONTAINER = jabber) @$(eval COMPOSE_RUN_COMMAND = exec) @$(eval BASH_RUN_SHELL_USER = root) - @$(eval COMPOSE_RUN_SHELL_FLAGS = ) + @$(eval COMPOSE_RUN_SHELL_FLAGS = -T) .database: @$(eval BASH_RUN_SHELL_CONTAINER = db) @$(eval COMPOSE_RUN_COMMAND = exec) @$(eval BASH_RUN_SHELL_USER = root) - @$(eval COMPOSE_RUN_SHELL_FLAGS = ) + @$(eval COMPOSE_RUN_SHELL_FLAGS = -T) .test: @$(eval BASH_RUN_SHELL_CONTAINER = jabber) @$(eval COMPOSE_RUN_COMMAND = exec) @$(eval BASH_RUN_SHELL_USER = app) - @$(eval COMPOSE_RUN_SHELL_FLAGS = ) + @$(eval COMPOSE_RUN_SHELL_FLAGS = -T) .disable-module-conf: # Disable $(MODULE) configuration diff --git a/README.md b/README.md index d0c9dc2..b7258d3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![ejabberd-unread](doc/assets/project.svg) -[![Build Status](https://api.travis-ci.com/hausgold/ejabberd-unread.svg?token=4XcyqxxmkyBSSV3wWRt7&branch=master)](https://travis-ci.com/hausgold/ejabberd-unread) +[![Test](https://github.com/hausgold/ejabberd-unread/actions/workflows/test.yml/badge.svg)](https://github.com/hausgold/ejabberd-unread/actions/workflows/test.yml) This is a custom [ejabberd](https://www.ejabberd.im/) module which allows users to acknowledge/retrieve their unread messages from direct chats and multi user diff --git a/include/mod_unread.hrl b/include/mod_unread.hrl index a197161..271f2df 100644 --- a/include/mod_unread.hrl +++ b/include/mod_unread.hrl @@ -1,2 +1,2 @@ --define(MODULE_VERSION, <<"1.0.4-471">>). +-define(MODULE_VERSION, <<"1.0.4-472">>). -define(NS_UNREAD, <<"urn:xmpp:unread">>). diff --git a/tests/package-lock.json b/tests/package-lock.json index 2ea39ea..8428e2d 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -355,9 +355,9 @@ } }, "highlight.js": { - "version": "9.18.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz", - "integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg==" + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==" }, "hostmeta": { "version": "2.0.2", @@ -538,9 +538,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash._arrayeach": { "version": "3.0.0", diff --git a/tests/package.json b/tests/package.json index e002623..38c3671 100644 --- a/tests/package.json +++ b/tests/package.json @@ -14,9 +14,9 @@ "colors": "^1.3.1", "css2json": "0.0.4", "faker": "^4.1.0", - "highlight.js": "^9.12.0", + "highlight.js": "^10.4.1", "html2json": "^1.0.2", - "lodash": "^4.17.15", + "lodash": "^4.17.21", "moment": "^2.27.0", "pg": "^8.2.2", "request": "^2.87.0",