From 26fe83d2c6e13cf6f01abc49f0fcaf38e2855ff5 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Sat, 3 Jul 2021 16:15:04 +0200 Subject: [PATCH] Add workflows triggered by crons to run on the latest development versions (#66) --- .github/workflows/ergo_devel.yml | 47 +++++++++++++++ .github/workflows/inspircd_devel.yml | 45 +++++++++++++++ .github/workflows/inspircd_devel_release.yml | 45 +++++++++++++++ .github/workflows/limnoria_devel.yml | 34 +++++++++++ .github/workflows/solanum_devel.yml | 45 +++++++++++++++ .github/workflows/sopel_devel.yml | 34 +++++++++++ .github/workflows/unrealircd.yml | 2 +- .github/workflows/unrealircd_devel.yml | 45 +++++++++++++++ make_workflows.py | 60 ++++++++++++++++++-- workflows.yml | 59 ++++++++++++++++--- 10 files changed, 400 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/ergo_devel.yml create mode 100644 .github/workflows/inspircd_devel.yml create mode 100644 .github/workflows/inspircd_devel_release.yml create mode 100644 .github/workflows/limnoria_devel.yml create mode 100644 .github/workflows/solanum_devel.yml create mode 100644 .github/workflows/sopel_devel.yml create mode 100644 .github/workflows/unrealircd_devel.yml diff --git a/.github/workflows/ergo_devel.yml b/.github/workflows/ergo_devel.yml new file mode 100644 index 0000000..2106dc0 --- /dev/null +++ b/.github/workflows/ergo_devel.yml @@ -0,0 +1,47 @@ +# This file was auto-generated by make_workflows.py. +# Do not edit it manually, modifications will be lost. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - uses: actions/setup-go@v2 + with: + go-version: ~1.16 + - run: go version + - name: Cache dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-ergo + path: |- + ~/.cache + $GITHUB_WORKSPACE/ergo + - name: Install dependencies + run: |- + sudo apt-get install atheme-services + python -m pip install --upgrade pip + pip install pytest -r requirements.txt + - name: Checkout Ergo + uses: actions/checkout@v2 + with: + path: ergo + ref: master + repository: ergochat/ergo + - name: Build Ergo + run: | + cd $GITHUB_WORKSPACE/ergo/ + make build + make install + - name: Test with pytest + run: PATH=~/go/bin:$PATH make ergo +name: irctest with Ergo +'on': + schedule: + - cron: 51 8 * * 6 + - cron: 51 8 * * 0 + - cron: 51 17 * * * diff --git a/.github/workflows/inspircd_devel.yml b/.github/workflows/inspircd_devel.yml new file mode 100644 index 0000000..33f82d8 --- /dev/null +++ b/.github/workflows/inspircd_devel.yml @@ -0,0 +1,45 @@ +# This file was auto-generated by make_workflows.py. +# Do not edit it manually, modifications will be lost. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Cache dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-inspircd + path: |- + ~/.cache + $GITHUB_WORKSPACE/inspircd + - name: Install dependencies + run: |- + sudo apt-get install atheme-services + python -m pip install --upgrade pip + pip install pytest -r requirements.txt + - name: Checkout InspIRCd + uses: actions/checkout@v2 + with: + path: inspircd + ref: master + repository: inspircd/inspircd + - name: Build InspIRCd + run: | + cd $GITHUB_WORKSPACE/inspircd/ + patch src/inspircd.cpp < $GITHUB_WORKSPACE/inspircd_mainloop.patch + ./configure --prefix=$HOME/.local/inspircd --development + make -j 4 + make install + - name: Test with pytest + run: PATH=~/.local/inspircd/bin:$PATH make inspircd +name: irctest with InspIRCd +'on': + schedule: + - cron: 51 8 * * 6 + - cron: 51 8 * * 0 + - cron: 51 17 * * * diff --git a/.github/workflows/inspircd_devel_release.yml b/.github/workflows/inspircd_devel_release.yml new file mode 100644 index 0000000..feeb5f9 --- /dev/null +++ b/.github/workflows/inspircd_devel_release.yml @@ -0,0 +1,45 @@ +# This file was auto-generated by make_workflows.py. +# Do not edit it manually, modifications will be lost. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Cache dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-inspircd + path: |- + ~/.cache + $GITHUB_WORKSPACE/inspircd + - name: Install dependencies + run: |- + sudo apt-get install atheme-services + python -m pip install --upgrade pip + pip install pytest -r requirements.txt + - name: Checkout InspIRCd + uses: actions/checkout@v2 + with: + path: inspircd + ref: insp3 + repository: inspircd/inspircd + - name: Build InspIRCd + run: | + cd $GITHUB_WORKSPACE/inspircd/ + patch src/inspircd.cpp < $GITHUB_WORKSPACE/inspircd_mainloop.patch + ./configure --prefix=$HOME/.local/inspircd --development + make -j 4 + make install + - name: Test with pytest + run: PATH=~/.local/inspircd/bin:$PATH make inspircd +name: irctest with InspIRCd +'on': + schedule: + - cron: 51 8 * * 6 + - cron: 51 8 * * 0 + - cron: 51 17 * * * diff --git a/.github/workflows/limnoria_devel.yml b/.github/workflows/limnoria_devel.yml new file mode 100644 index 0000000..779a2dd --- /dev/null +++ b/.github/workflows/limnoria_devel.yml @@ -0,0 +1,34 @@ +# This file was auto-generated by make_workflows.py. +# Do not edit it manually, modifications will be lost. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Cache dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-limnoria + path: |- + ~/.cache + $GITHUB_WORKSPACE/placeholder + - name: Install dependencies + run: |- + sudo apt-get install atheme-services + python -m pip install --upgrade pip + pip install pytest -r requirements.txt + - name: Install dependencies + run: pip install git+https://github.com/ProgVal/Limnoria.git@testing cryptography + - name: Test with pytest + run: PATH=~/.local/bin:$PATH make limnoria +name: irctest with Limnoria +'on': + schedule: + - cron: 51 8 * * 6 + - cron: 51 8 * * 0 + - cron: 51 17 * * * diff --git a/.github/workflows/solanum_devel.yml b/.github/workflows/solanum_devel.yml new file mode 100644 index 0000000..9182ac4 --- /dev/null +++ b/.github/workflows/solanum_devel.yml @@ -0,0 +1,45 @@ +# This file was auto-generated by make_workflows.py. +# Do not edit it manually, modifications will be lost. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Cache dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-solanum + path: |- + ~/.cache + $GITHUB_WORKSPACE/solanum + - name: Install dependencies + run: |- + sudo apt-get install atheme-services + python -m pip install --upgrade pip + pip install pytest -r requirements.txt + - name: Checkout Solanum + uses: actions/checkout@v2 + with: + path: solanum + ref: main + repository: solanum-ircd/solanum + - name: Build Solanum + run: | + cd $GITHUB_WORKSPACE/solanum/ + ./autogen.sh + ./configure --prefix=$HOME/.local/ + make -j 4 + make install + - name: Test with pytest + run: PATH=~/.local/bin:$PATH make solanum +name: irctest with Solanum +'on': + schedule: + - cron: 51 8 * * 6 + - cron: 51 8 * * 0 + - cron: 51 17 * * * diff --git a/.github/workflows/sopel_devel.yml b/.github/workflows/sopel_devel.yml new file mode 100644 index 0000000..b703b04 --- /dev/null +++ b/.github/workflows/sopel_devel.yml @@ -0,0 +1,34 @@ +# This file was auto-generated by make_workflows.py. +# Do not edit it manually, modifications will be lost. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Cache dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-sopel + path: |- + ~/.cache + $GITHUB_WORKSPACE/placeholder + - name: Install dependencies + run: |- + sudo apt-get install atheme-services + python -m pip install --upgrade pip + pip install pytest -r requirements.txt + - name: Install dependencies + run: pip install git+https://github.com/sopel-irc/sopel.git + - name: Test with pytest + run: PATH=~/.local/bin:$PATH make sopel +name: irctest with Sopel +'on': + schedule: + - cron: 51 8 * * 6 + - cron: 51 8 * * 0 + - cron: 51 17 * * * diff --git a/.github/workflows/unrealircd.yml b/.github/workflows/unrealircd.yml index 6496094..41e8e13 100644 --- a/.github/workflows/unrealircd.yml +++ b/.github/workflows/unrealircd.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v2 with: path: unrealircd - ref: unreal52 + ref: 94993a03ca8d3c193c0295c33af39270c3f9d27d repository: unrealircd/unrealircd - name: Build UnrealIRCd run: | diff --git a/.github/workflows/unrealircd_devel.yml b/.github/workflows/unrealircd_devel.yml new file mode 100644 index 0000000..b2d7742 --- /dev/null +++ b/.github/workflows/unrealircd_devel.yml @@ -0,0 +1,45 @@ +# This file was auto-generated by make_workflows.py. +# Do not edit it manually, modifications will be lost. + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Cache dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-unrealircd + path: |- + ~/.cache + $GITHUB_WORKSPACE/unrealircd + - name: Install dependencies + run: |- + sudo apt-get install atheme-services + python -m pip install --upgrade pip + pip install pytest -r requirements.txt + - name: Checkout UnrealIRCd + uses: actions/checkout@v2 + with: + path: unrealircd + ref: unreal52 + repository: unrealircd/unrealircd + - name: Build UnrealIRCd + run: | + cd $GITHUB_WORKSPACE/unrealircd/ + cp $GITHUB_WORKSPACE/unreal/* . + CFLAGS=-O0 ./Config -quick + make -j 4 + make install + - name: Test with pytest + run: PATH=~/.local/unrealircd/bin:$PATH make unrealircd +name: irctest with UnrealIRCd +'on': + schedule: + - cron: 51 8 * * 6 + - cron: 51 8 * * 0 + - cron: 51 17 * * * diff --git a/make_workflows.py b/make_workflows.py index 9c783c7..fcb1992 100644 --- a/make_workflows.py +++ b/make_workflows.py @@ -8,6 +8,7 @@ The point is that we had/have a lot of duplications between files in and keep them in sync. """ +import enum import pathlib import yaml @@ -33,15 +34,36 @@ class Dumper(yaml.Dumper): Dumper.add_representer(script, script_representer) -def generate_workflow(config, software_id): +class VersionFlavor(enum.Enum): + STABLE = "stable" + """A statically defined version, that we already tested irctest on. + This is ran on PRs and master, because failure guarantees it's a bug in + the new irctest commit/PR.""" + RELEASE = "release" + """The last release of the project. This should usually pass. + We don't currently use this.""" + DEVEL = "devel" + """The last commit of the project. This allows us to catch bugs in other + software early in their development process.""" + DEVEL_RELEASE = "devel_release" + """Ditto, but if the project uses a specific branch for their current + release series, it uses that branch instead""" + + +def generate_workflow(config: dict, software_id: str, version_flavor: VersionFlavor): software_config = config["software"][software_id] name = software_config["name"] prefix = software_config.get("prefix", "~/.local") if "install_steps" in software_config: path = "placeholder" # TODO: remove this - install_steps = software_config["install_steps"] + install_steps = software_config["install_steps"][version_flavor.value] + if install_steps is None: + return else: + ref = software_config["refs"][version_flavor.value] + if ref is None: + return path = software_config["path"] install_steps = [ { @@ -49,7 +71,7 @@ def generate_workflow(config, software_id): "uses": "actions/checkout@v2", "with": { "repository": software_config["repository"], - "ref": software_config["ref"], + "ref": ref, "path": path, }, }, @@ -59,9 +81,24 @@ def generate_workflow(config, software_id): }, ] + on: dict + if version_flavor == VersionFlavor.STABLE: + on = {"push": None, "pull_request": None} + else: + # Run every saturday and sunday 8:51 UTC, and every day at 17:51 + # (minute choosen at random, hours and days is so that I'm available + # to fix bugs it detects) + on = { + "schedule": [ + {"cron": "51 8 * * 6"}, + {"cron": "51 8 * * 0"}, + {"cron": "51 17 * * *"}, + ] + } + workflow = { "name": f"irctest with {name}", - "on": {"push": None, "pull_request": None}, + "on": on, "jobs": { "build": { "runs-on": "ubuntu-latest", @@ -104,7 +141,14 @@ def generate_workflow(config, software_id): }, } - with open(GH_WORKFLOW_DIR / f"{software_id}.yml", "wt") as fd: + if version_flavor == VersionFlavor.STABLE: + workflow_filename = GH_WORKFLOW_DIR / f"{software_id}.yml" + else: + workflow_filename = ( + GH_WORKFLOW_DIR / f"{software_id}_{version_flavor.value}.yml" + ) + + with open(workflow_filename, "wt") as fd: fd.write("# This file was auto-generated by make_workflows.py.\n") fd.write("# Do not edit it manually, modifications will be lost.\n\n") fd.write(yaml.dump(workflow, Dumper=Dumper)) @@ -115,7 +159,11 @@ def main(): config = yaml.load(fd, Loader=yaml.Loader) for software_id in config["software"]: - generate_workflow(config, software_id) + generate_workflow(config, software_id, version_flavor=VersionFlavor.STABLE) + generate_workflow(config, software_id, version_flavor=VersionFlavor.DEVEL) + generate_workflow( + config, software_id, version_flavor=VersionFlavor.DEVEL_RELEASE + ) if __name__ == "__main__": diff --git a/workflows.yml b/workflows.yml index b928d34..f8be929 100644 --- a/workflows.yml +++ b/workflows.yml @@ -1,12 +1,19 @@ # Input used by make_workflows.py to generate .github/workflows/ +# See VersionFlavor in the script to see how stabl/release/devel/devel_release +# are defined. + software: ############################# # Charybdis family: charybdis: name: Charybdis repository: charybdis-ircd/charybdis - ref: charybdis-4.1.2 + refs: + stable: charybdis-4.1.2 + release: null + devel: null + devel_release: null path: charybdis build_script: | cd $GITHUB_WORKSPACE/charybdis/ @@ -18,7 +25,13 @@ software: solanum: name: Solanum repository: solanum-ircd/solanum - ref: e370888264da666a1bd9faac86cd5f2aa06084f4 + refs: + # Actually Solanum doesn't have releases; so we just bump this + # commit hash from time to time + stable: e370888264da666a1bd9faac86cd5f2aa06084f4 + release: null + devel: main + devel_release: null path: solanum build_script: | cd $GITHUB_WORKSPACE/solanum/ @@ -32,7 +45,11 @@ software: ergo: name: Ergo repository: ergochat/ergo - ref: irctest_stable + refs: + stable: irctest_stable + release: stable + devel: master + devel_release: null path: ergo prefix: ~/go pre_deps: @@ -48,7 +65,11 @@ software: inspircd: name: InspIRCd repository: inspircd/inspircd - ref: v3.8.1 + refs: + stable: v3.8.1 + release: null + devel: master + devel_release: insp3 path: inspircd prefix: ~/.local/inspircd build_script: | @@ -61,7 +82,11 @@ software: unrealircd: name: UnrealIRCd repository: unrealircd/unrealircd - ref: unreal52 + refs: + stable: 94993a03ca8d3c193c0295c33af39270c3f9d27d # 5.2.1-rc1 + release: null + devel: unreal52 + devel_release: null path: unrealircd prefix: ~/.local/unrealircd build_script: | @@ -77,11 +102,27 @@ software: limnoria: name: Limnoria install_steps: - - name: Install dependencies - run: pip install limnoria==2021.01.15 cryptography + stable: + - name: Install dependencies + run: pip install limnoria==2021.01.15 cryptography + release: + - name: Install dependencies + run: pip install limnoria cryptography + devel: + - name: Install dependencies + run: pip install git+https://github.com/ProgVal/Limnoria.git@testing cryptography + devel_release: null sopel: name: Sopel install_steps: - - name: Install dependencies - run: pip install sopel==7.0.7 + stable: + - name: Install dependencies + run: pip install sopel==7.0.7 + release: + - name: Install dependencies + run: pip install sopel + devel: + - name: Install dependencies + run: pip install git+https://github.com/sopel-irc/sopel.git + devel_release: null