test on staging #357
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
env: | |
CONTAINER_REGISTRY_USERNAME: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
CONTAINER_REGISTRY_TOKEN: ${{ secrets.CONTAINER_REGISTRY_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- name: Install docker for ansible | |
run: | | |
ansible-galaxy collection install community.docker:3.4.5 | |
pipx inject ansible-core docker six | |
- 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: 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: Build judgels-server | |
if: steps.changed-files.outputs.judgels-server == '1' | |
run: ./deployment/scripts/build_judgels_server.sh | |
- name: Build judgels-client | |
if: steps.changed-files.outputs.judgels-client == '1' | |
run: ./deployment/scripts/build_judgels_client.sh | |
- name: Build judgels-grader | |
if: steps.changed-files.outputs.judgels-grader == '1' | |
run: ./deployment/scripts/build_judgels_grader.sh | |
deploy-tlx-staging: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- name: Check out deployment repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ secrets.TLX_STAGING_DEPLOYMENT_REPOSITORY }} | |
token: ${{ secrets.TLX_STAGING_DEPLOYMENT_TOKEN }} | |
path: deployment/ansible/env | |
- name: Prepare staging environment SSH key | |
run: chmod 600 deployment/ansible/env/deployment_rsa | |
- id: changed-files | |
name: Check changed files | |
run: python3 ci/check-changed-files.py | bash | |
- name: Deploy judgels-server | |
if: steps.changed-files.outputs.judgels-server == '1' | |
run: | | |
eval "$(ssh-agent -s)" | |
ssh-add deployment/ansible/env/deployment_rsa | |
./deployment/scripts/deploy_judgels_server.sh | |
- name: Deploy judgels-client | |
if: steps.changed-files.outputs.judgels-client == '1' | |
run: | | |
eval "$(ssh-agent -s)" | |
ssh-add deployment/ansible/env/deployment_rsa | |
./deployment/scripts/deploy_judgels_client.sh | |
- name: Deploy judgels-grader | |
if: steps.changed-files.outputs.judgels-grader == '1' | |
run: | | |
eval "$(ssh-agent -s)" | |
ssh-add deployment/ansible/env/deployment_rsa | |
./deployment/scripts/deploy_judgels_grader.sh |