From 8af1b3bff8de32e524439d2a8976eace4a839fef Mon Sep 17 00:00:00 2001 From: Ashar Fuadi Date: Sun, 15 Oct 2023 17:43:50 +0700 Subject: [PATCH] test on staging --- .github/workflows/ci.yml | 130 ++------------------------------------- 1 file changed, 5 insertions(+), 125 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e5e6be76..6c38c2881 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,92 +3,13 @@ name: ci on: push: branches: - - '*' + - "*" pull_request: branches: - master jobs: - test: - runs-on: ubuntu-22.04 - services: - rabbitmq: - image: rabbitmq - ports: - - 5672:5672 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 50 - - - id: changed-files - name: Check changed files - run: python3 ci/check-changed-files.py | bash - - - name: Set up JDK - if: steps.changed-files.outputs.gradle == '1' - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '11' - cache: 'gradle' - - - name: Test judgels-commons - if: steps.changed-files.outputs.judgels-commons == '1' - run: ./judgels-backends/gradlew -p judgels-backends/judgels-commons check - - - name: Test judgels-grader-api - if: steps.changed-files.outputs.judgels-grader == '1' - run: ./judgels-backends/gradlew -p judgels-backends/judgels-grader-api check - - - name: Test judgels-grader-engines - if: steps.changed-files.outputs.judgels-grader == '1' - run: ./judgels-backends/gradlew -p judgels-backends/judgels-grader-engines check - - - name: Test judgels-grader-app - if: steps.changed-files.outputs.judgels-grader == '1' - run: ./judgels-backends/gradlew -p judgels-backends/judgels-grader-app check - - - name: Test judgels-server-api - if: steps.changed-files.outputs.judgels-server == '1' - run: ./judgels-backends/gradlew -p judgels-backends/judgels-server-api check - - - name: Test judgels-server-app - if: steps.changed-files.outputs.judgels-server == '1' - run: ./judgels-backends/gradlew -p judgels-backends/judgels-server-app check - - - name: Set up node - if: steps.changed-files.outputs.yarn == '1' - uses: actions/setup-node@v3 - with: - node-version: '16' - - - name: Get yarn cache directory path - if: steps.changed-files.outputs.yarn == '1' - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - name: Use yarn cache - if: steps.changed-files.outputs.yarn == '1' - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Test judgels-client - if: steps.changed-files.outputs.judgels-client == '1' - run: | - cd judgels-client - export NODE_OPTIONS="--max-old-space-size=4096" - yarn install - yarn ci - build: - needs: test - if: github.ref == 'refs/heads/master' && github.repository_owner == 'ia-toki' runs-on: ubuntu-22.04 env: CONTAINER_REGISTRY_USERNAME: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} @@ -111,15 +32,15 @@ jobs: if: steps.changed-files.outputs.gradle == '1' uses: actions/setup-java@v3 with: - distribution: 'zulu' - java-version: '11' - cache: 'gradle' + distribution: "zulu" + java-version: "11" + cache: "gradle" - name: Set up node if: steps.changed-files.outputs.yarn == '1' uses: actions/setup-node@v3 with: - node-version: '16' + node-version: "16" - name: Get yarn cache directory path if: steps.changed-files.outputs.yarn == '1' @@ -148,49 +69,8 @@ jobs: if: steps.changed-files.outputs.judgels-grader == '1' run: ./deployment/scripts/build_judgels_grader.sh - deploy-web: - if: github.ref == 'refs/heads/master' && github.repository_owner == 'ia-toki' - runs-on: ubuntu-22.04 - env: - WEB_HOST: ${{ secrets.WEB_HOST }} - WEB_KNOWN_HOSTS: ${{ secrets.WEB_KNOWN_HOSTS }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 50 - - - id: changed-files - name: Check changed files - run: python3 ci/check-changed-files.py | bash - - - name: Set up node - if: steps.changed-files.outputs.web == '1' - uses: actions/setup-node@v3 - with: - node-version: '16' - - - name: Build web - if: steps.changed-files.outputs.web == '1' - run: | - cd web - yarn install - yarn build - - - name: Install SSH key - if: steps.changed-files.outputs.web == '1' - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.WEB_PRIVATE_KEY }} - known_hosts: ${{ secrets.WEB_KNOWN_HOSTS }} - - - name: Rsync web - if: steps.changed-files.outputs.web == '1' - run: rsync -avzh web/build/ root@${WEB_HOST}:/var/www/html/judgels --delete - deploy-tlx-staging: needs: build - if: github.ref == 'refs/heads/master' && github.repository_owner == 'ia-toki' runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3