refactor: move shared modules to core/, delete legacy code #101
This file contains hidden or 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/CD | |
| on: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: deploy-production | |
| cancel-in-progress: false | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: pyproject.toml | |
| - run: cp .env.example .env | |
| - run: pip install -e ".[dev]" pyright | |
| - run: pyright src/ | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: pyproject.toml | |
| - run: cp .env.example .env | |
| - run: pip install -e ".[dev]" | |
| - run: pytest -v --junitxml=test-results.xml || [ $? -eq 5 ] | |
| - uses: EnricoMi/publish-unit-test-result-action@v2.23.0 | |
| if: always() | |
| with: | |
| files: test-results.xml | |
| deploy: | |
| needs: [lint, test] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout credentials | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: BCSDLab/bcsdlab-credentials | |
| ssh-key: ${{ secrets.CONFIG_REPO_PEM_KEY }} | |
| path: credentials | |
| persist-credentials: false | |
| - name: Upload credentials to server | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SERVER_SSH_KEY }} | |
| port: ${{ secrets.SERVER_PORT }} | |
| source: "credentials/bcsd-api/backend/*" | |
| target: "~/BCSD_API" | |
| strip_components: 3 | |
| - name: Clean up credentials from runner | |
| if: always() | |
| run: rm -rf credentials | |
| - name: Deploy | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SERVER_SSH_KEY }} | |
| port: ${{ secrets.SERVER_PORT }} | |
| script: | | |
| cd ~/BCSD_API | |
| git fetch origin main | |
| git reset --hard origin/main | |
| bash infra/scripts/deploy.sh |