Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
cirrus-ci_task:
container:
image: toxchat/toktok-stack:0.0.23-third_party
image: toxchat/toktok-stack:0.0.31-third_party
cpu: 2
memory: 6G
configure_script:
Expand Down
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

18 changes: 9 additions & 9 deletions github-tools.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ library
, containers
, cryptohash
, exceptions
, github == 0.25
, github >= 0.25 && <= 0.26
, html
, http-client >= 0.4.30
, http-client-tls
Expand All @@ -139,9 +139,9 @@ executable hub-pulls
hs-source-dirs: tools
default-language: Haskell2010
build-depends:
base >= 4 && < 5
base
, bytestring
, github == 0.25
, github
, github-tools
, text

Expand All @@ -152,9 +152,9 @@ executable hub-changelog
hs-source-dirs: tools
default-language: Haskell2010
build-depends:
base >= 4 && < 5
base
, bytestring
, github == 0.25
, github
, github-tools
, text

Expand All @@ -165,9 +165,9 @@ executable hub-roadmap
hs-source-dirs: tools
default-language: Haskell2010
build-depends:
base >= 4 && < 5
base
, bytestring
, github == 0.25
, github
, github-tools
, text

Expand All @@ -181,14 +181,14 @@ executable webservice
TokTok.Hello
TokTok.Webhooks
build-depends:
base >= 4 && < 5
base
, Diff
, github-tools
, aeson-pretty
, bytestring
, case-insensitive
, expiring-cache-map
, github == 0.25
, github
, http-media
, http-types
, pretty
Expand Down
5 changes: 2 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
packages: [.]
resolver: lts-14.27
resolver: lts-18.18
extra-deps:
- binary-instances-1@sha256:b17565598b8df3241f9b46fa8e3a3368ecc8e3f2eb175d7c28f319042a6f5c79,2613
- github-0.25@sha256:32e1ede86a04976e06740a5993fab5306c5dbfdd17e96d83b79e53b82195739e,7091
- github-0.26@sha256:a9d4046325c3eb28cdc7bef2c3f5bb213328caeae0b7dce6f51de655f0bffaa1,7162
84 changes: 84 additions & 0 deletions tools/check_release
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
from typing import List

import requests

bzl_data = {}


def glob(*args, **kwargs):
pass


def load(*args):
pass


def project(**kwargs):
pass


def hazel_library(pkg):
return pkg


def haskell_library(version: str, **kwargs):
bzl_data["version"] = version


def hspec_test(**kwargs):
pass


def github_repo():
repo = os.environ.get("GITHUB_REPOSITORY")
if repo:
return repo
return (subprocess.run(
["git", "remote", "get-url", "upstream"],
check=True,
capture_output=True).stdout.decode("utf-8").strip().split(":")[1])


def release_github():
resp = requests.get(
f"{os.environ['GITHUB_API_URL']}/repos/{github_repo()}/releases",
auth=(os.environ["GH_USER"], os.environ["GH_TOKEN"]),
)
release = resp.json()[0]
if not release["draft"]:
print("Could not find the latest draft release.")
print(f"Latest release found was {release['name']}")
sys.exit(1)
return release["name"][1:]


def release_bazel(path: str):
with open(os.path.join(path, "BUILD.bazel"), "r") as fh:
exec(fh.read())
return bzl_data["version"]


def main(prog: str, args: List[str]):
if len(args) != 1:
print(f"Usage: {prog}")
sys.exit(1)

path = args[0]

gh_release = release_github()
bzl_release = release_bazel(path)

if gh_release == bzl_release:
print(f"PASS: Upcoming release version is {gh_release}")
else:
print(f"FAIL: GitHub draft release {gh_release} does not match "
f"BUILD.bazel {bzl_release}")
sys.exit(1)


if __name__ == "__main__":
main(sys.argv[0], sys.argv[1:])
11 changes: 6 additions & 5 deletions tools/git-submit
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#!/bin/sh
#!/bin/bash

set -eu

REMOTE=""
BRANCH="${1-master}"
BRANCH="${1-$(git rev-parse --abbrev-ref HEAD)}"

if (echo "$BRANCH" | grep ':' > /dev/null); then
if (echo "$BRANCH" | grep ':' >/dev/null); then
REMOTE="$(echo "$BRANCH" | grep -o '^[^:]*')"
BRANCH="$(echo "$BRANCH" | grep -o '[^:]*$')"
REMOTE="$(git remote -v | grep ":$REMOTE/.* (push)" | grep -o '^\S*')"
fi

if [ -n "$REMOTE" ] && ! (git branch | grep "^..$BRANCH\$" > /dev/null); then
if [ -n "$REMOTE" ] && ! (git branch | grep "^..$BRANCH\$" >/dev/null); then
git checkout --track "$REMOTE/$BRANCH"
else
git checkout $BRANCH
git checkout "$BRANCH"
fi

git push upstream "$BRANCH:master"
git sync
git branch -d "$BRANCH"
sleep 2
git push origin ":$BRANCH"