diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 36c4447..d8380ce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,6 +13,28 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Run tests + run: | + go test ./... -v -race -coverprofile cover.out -covermode=atomic + - name: Tests fail notif + if: failure() + id: test_fail_notif + uses: ./ + with: # Set the secrets as inputs + # Login expects the bot's bare jid (user@domain) + login: ${{ secrets.bot_username }} + pass: ${{ secrets.bot_password }} + server_domain: ${{ secrets.server_rooms_domain }} + # Correspondent is the intended recipient of the notification. + # If it is a single user, the bare Jid is expected (jid without resource) + # If it is a chat room, only the name of it is expected, and "server_domain" will be used to complete the jid + correspondant: ${{ secrets.room_correspondent }} + # Port is optional. Defaults to 5222 + server_port: ${{ secrets.server_port }} + message: | + tests for the following commit have failed : ${{ github.event.pull_request.html_url }} + # Boolean to indicate if correspondent should be treated as a room (true) or a single user + correspondent_is_room: true - name: push_info_step id: push uses: ./ @@ -61,4 +83,4 @@ jobs: message: | ${{ github.actor }} edited the following PR : ${{ github.event.pull_request.html_url }} with message : ${{ github.event.pull_request.title }} - correspondent_is_room: true \ No newline at end of file + correspondent_is_room: true diff --git a/dummy_test.go b/dummy_test.go new file mode 100644 index 0000000..0883cc4 --- /dev/null +++ b/dummy_test.go @@ -0,0 +1,7 @@ +package main + +import "testing" + +func TestAlwaysFails(t *testing.T) { + t.Fatal("I always fail") +}