From 3f6327a134500b98c817a83f9ca3fb9e08d68491 Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Wed, 19 Jun 2024 01:32:54 +0800 Subject: [PATCH] ci/cd: add build and check workflows --- .github/workflows/cd-docs.yml | 42 +++++++++++++++++++++++++++++++ .github/workflows/cd-telegram.yml | 28 +++++++++++++++++++++ .github/workflows/cd-whatsapp.yml | 28 +++++++++++++++++++++ .github/workflows/ci-spow.yml | 22 ++++++++++++++++ .github/workflows/ci-telegram.yml | 22 ++++++++++++++++ .github/workflows/ci-whatsapp.yml | 22 ++++++++++++++++ 6 files changed, 164 insertions(+) create mode 100644 .github/workflows/cd-docs.yml create mode 100644 .github/workflows/cd-telegram.yml create mode 100644 .github/workflows/cd-whatsapp.yml create mode 100644 .github/workflows/ci-spow.yml create mode 100644 .github/workflows/ci-telegram.yml create mode 100644 .github/workflows/ci-whatsapp.yml diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml new file mode 100644 index 0000000..616685a --- /dev/null +++ b/.github/workflows/cd-docs.yml @@ -0,0 +1,42 @@ +name: "continuous deployment: surplus Documentation" + +on: + workflow_dispatch: + push: + paths: + - "docs/**" + - "mkdocs.yml" + - "src/spow-telegram-bridge/*.py" + - "src/**/*LICENCE*" + - "docs/**/*LICENCE*" + - "docs/**/*LICENSE*" + - "docs/CC0" + - "*LICENCE*" + - "src/surplus-on-wheels/s+ow" + - "src/surplus-on-wheels/install.sh" + - "src/spow-whatsapp-bridge/install.sh" + - "src/spow-telegram-bridge/install.sh" + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: publish surplus Documentation + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + github_access_token: ${{ secrets.GITHUB_TOKEN }} + + - run: nix develop --impure --command hatch run docs:build + + - uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: surplus + directory: site + gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cd-telegram.yml b/.github/workflows/cd-telegram.yml new file mode 100644 index 0000000..2f8ebbd --- /dev/null +++ b/.github/workflows/cd-telegram.yml @@ -0,0 +1,28 @@ +name: "continuous deployment: Telegram Bridge" + +on: + workflow_dispatch: + push: + paths: + - "src/spow-telegram-bridge/**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: DeterminateSystems/magic-nix-cache-action@main + + - run: | + cd src/spow-telegram-bridge + nix develop --command poetry build + + - uses: actions/upload-artifact@v4 + with: + name: "spow-telegram-bridge" + path: src/spow-whatsapp-bridge/dist + retention-days: 14 diff --git a/.github/workflows/cd-whatsapp.yml b/.github/workflows/cd-whatsapp.yml new file mode 100644 index 0000000..3bdba77 --- /dev/null +++ b/.github/workflows/cd-whatsapp.yml @@ -0,0 +1,28 @@ +name: "continuous deployment: WhatsApp Bridge" + +on: + workflow_dispatch: + push: + paths: + - "src/spow-whatsapp-bridge/**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: DeterminateSystems/magic-nix-cache-action@main + + - run: | + cd src/spow-whatsapp-bridge + nix build .#termux + + - uses: actions/upload-artifact@v4 + with: + name: "spow-whatsapp-bridge-android" + path: src/spow-whatsapp-bridge/result + retention-days: 14 diff --git a/.github/workflows/ci-spow.yml b/.github/workflows/ci-spow.yml new file mode 100644 index 0000000..f88761e --- /dev/null +++ b/.github/workflows/ci-spow.yml @@ -0,0 +1,22 @@ +name: "continuous integration: s+ow" + +on: + workflow_dispatch: + push: + paths: + - "src/surplus-on-wheels/**" + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: DeterminateSystems/magic-nix-cache-action@main + + - run: | + cd src/spow-whatsapp-bridge + nix develop --command ./check.sh diff --git a/.github/workflows/ci-telegram.yml b/.github/workflows/ci-telegram.yml new file mode 100644 index 0000000..2c6061a --- /dev/null +++ b/.github/workflows/ci-telegram.yml @@ -0,0 +1,22 @@ +name: "continuous integration: Telegram Bridge" + +on: + workflow_dispatch: + push: + paths: + - "src/spow-telegram-bridge/**" + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: DeterminateSystems/magic-nix-cache-action@main + + - run: | + cd src/spow-telegram-bridge + nix develop --command ./check.sh diff --git a/.github/workflows/ci-whatsapp.yml b/.github/workflows/ci-whatsapp.yml new file mode 100644 index 0000000..417166b --- /dev/null +++ b/.github/workflows/ci-whatsapp.yml @@ -0,0 +1,22 @@ +name: "continuous integration: WhatsApp Bridge" + +on: + workflow_dispatch: + push: + paths: + - "src/spow-whatsapp-bridge/**" + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: DeterminateSystems/magic-nix-cache-action@main + + - run: | + cd src/spow-whatsapp-bridge + nix develop --command ./check.sh