summaryrefslogtreecommitdiffstats
path: root/.github/workflows/build-release.yml
blob: 7243d661ac54f413a59195518b3f7d5c2b67ef4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build and publish app release

on:
  release:
      types: [published]

env:
  APP_NAME: news

jobs:
  build_and_publish:
    environment: release
    runs-on: ubuntu-latest
    name: "Release: build, sign and upload the app"
    strategy:
      matrix:
        php-versions: ['7.4']
        nextcloud: ['stable21']
        database: ['sqlite']
    steps:
      - name: Checkout
        uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f

      - name: Setup PHP
        uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip
          coverage: none

      - name: Set up server non MySQL
        uses: SMillerDev/nextcloud-actions/setup-nextcloud@fae87e29aa7cdf1ea0b8033c67f60e75b10be2cd
        with:
          cron: false
          version: ${{ matrix.nextcloud }}
          database-type: ${{ matrix.database }}

      - name: Prime app build
        run: make

      - name: Configure server with app
        uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@fae87e29aa7cdf1ea0b8033c67f60e75b10be2cd
        with:
          app: ${{ env.APP_NAME }}
          check-code: false

      - name: Create signed release archive
        run: |
          cd ../server/apps/${{ env.APP_NAME }} && make appstore
          rm -f ~/.nextcloud/certificates/*
        env:
          app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
          app_public_crt: ${{ secrets.APP_PUBLIC_CRT }}

      - name: Upload app tarball to release
        uses: svenstaro/upload-release-action@483c1e56f95e88835747b1c7c60581215016cbf2
        id: attach_to_release
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: ../server/apps/${{ env.APP_NAME }}/build/artifacts/appstore/${{ env.APP_NAME }}.tar.gz
          asset_name: ${{ env.APP_NAME }}.tar.gz
          tag: ${{ github.ref }}
          overwrite: true

      - name: Upload app to Nextcloud appstore
        uses: R0Wi/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1
        with:
          app_name: ${{ env.APP_NAME }}
          appstore_token: ${{ secrets.APPSTORE_TOKEN }}
          download_url: ${{ steps.attach_to_release.outputs.browser_download_url }}
          app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
          nightly: ${{ github.event.release.prerelease }}
n", r, n1, n2); break; case EVAL_OPERATOR_MULTIPLY: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 * n2; print_depth(depth); printf("%Lf = %Lf * %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_DIVIDE: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 / n2; print_depth(depth); printf("%Lf = %Lf / %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_NOT: n1 = evaluate_value(&op->ops[0], depth); r = !n1; print_depth(depth); printf("%Lf = NOT %Lf\n", r, n1); break; case EVAL_OPERATOR_AND: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 && n2; print_depth(depth); printf("%Lf = %Lf AND %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_OR: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 || n2; print_depth(depth); printf("%Lf = %Lf OR %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_GREATER_THAN_OR_EQUAL: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 >= n2; print_depth(depth); printf("%Lf = %Lf >= %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_LESS_THAN_OR_EQUAL: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 <= n2; print_depth(depth); printf("%Lf = %Lf <= %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_GREATER: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 > n2; print_depth(depth); printf("%Lf = %Lf > %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_LESS: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 < n2; print_depth(depth); printf("%Lf = %Lf < %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_NOT_EQUAL: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 != n2; print_depth(depth); printf("%Lf = %Lf <> %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_EQUAL: if(op->count != 2) fatal("Operator '%c' requires 2 values, but we have %d", op->operator, op->count); n1 = evaluate_value(&op->ops[0], depth); n2 = evaluate_value(&op->ops[1], depth); r = n1 == n2; print_depth(depth); printf("%Lf = %Lf == %Lf\n", r, n1, n2); break; case EVAL_OPERATOR_EXPRESSION_OPEN: printf("BEGIN SUB-EXPRESSION\n"); r = evaluate_value(&op->ops[0], depth + 1); printf("END SUB-EXPRESSION\n"); break; case EVAL_OPERATOR_NOP: case EVAL_OPERATOR_VALUE: r = evaluate_value(&op->ops[0], depth); break; default: error("I don't know how to handle operator '%c'", op->operator); r = 0; break; } return r; } void print_expression(EVAL_NODE *op, const char *failed_at, int error) { if(op) { printf("expression tree:\n"); print_node(op, 0); printf("\nevaluation steps:\n"); evaluate(op, 0); int error; calculated_number ret = expression_evaluate(op, &error); printf("\ninternal evaluator:\nSTATUS: %d, RESULT = %Lf\n", error, ret); expression_free(op); } else { printf("error: %d, failed_at: '%s'\n", error, (failed_at)?failed_at:"<NONE>"); } } */ int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, calculated_number *result) { (void)variable; (void)hash; (void)rc; (void)result; return 0; } int main(int argc, char **argv) { if(argc != 2) { fprintf(stderr, "I need an epxression (enclose it in single-quotes (') as a single parameter)\n"); exit(1); } const char *failed_at = NULL; int error; EVAL_EXPRESSION *exp = expression_parse(argv[1], &failed_at, &error); if(!exp) printf("\nPARSING FAILED\nExpression: '%s'\nParsing stopped at: '%s'\nParsing error code: %d (%s)\n", argv[1], (failed_at)?((*failed_at)?failed_at:"<END OF EXPRESSION>"):"<NONE>", error, expression_strerror(error)); else { printf("\nPARSING OK\nExpression: '%s'\nParsed as : '%s'\nParsing error code: %d (%s)\n", argv[1], exp->parsed_as, error, expression_strerror(error)); if(expression_evaluate(exp)) { printf("\nEvaluates to: %Lf\n\n", exp->result); } else { printf("\nEvaluation failed with code %d and message: %s\n\n", exp->error, buffer_tostring(exp->error_msg)); } expression_free(exp); } return 0; }