From bd2fb4a76c21444188e0d466870c96b0dd7bd735 Mon Sep 17 00:00:00 2001 From: Amir Mohammadi Date: Mon, 13 May 2024 22:40:18 +0330 Subject: [PATCH] deploy faster than brewing a cup of joe! --- .github/workflows/ci.yaml | 43 +++++++++++++++++++++++++++++++++++++++ src/config.rs | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..b62553c --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,43 @@ +name: CI/CD + +on: + push: + branches: + - main + paths-ignore: + - 'README.md' + - 'LICENSE.md' + pull_request: + branches: + - main + paths-ignore: + - 'README.md' + - 'LICENSE.md' + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: running tests + run: cargo test --verbose + + deploy: + runs-on: ubuntu-latest + environment: wiseass + needs: test + if: github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v3 + - name: prepare env + run: touch .env + - name: deploy + run: make deploy + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + TOKEN: ${{ secrets.TELEGRAM_TOKEN }} + KV_BINDING: ${{ secrets.KV_BINDING }} + KV_ID: ${{ secrets.KV_ID }} diff --git a/src/config.rs b/src/config.rs index 42497cc..33375a3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -29,7 +29,7 @@ mod tests { let config = include_str!("../config-example.toml"); let result: Config = toml::from_str(config).unwrap(); - assert_eq!(result.bot.admin_users_id, [7357]); + assert_eq!(result.bot.admin_users_id, [UserId(7357)]); assert_eq!(result.bot.report_chat_id, ChatId(7357)); } }