Add instruction presets #508
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: build | |
| on: | |
| push: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| run: pip install uv | |
| - name: Install dependencies | |
| run: uv sync --frozen | |
| - name: Run tests | |
| run: uv run pytest | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| run: pip install uv | |
| - name: Install dependencies | |
| run: uv sync --frozen | |
| - name: Run pre-commit hooks | |
| run: make lint | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Create GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Login to GHCR | |
| run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Build Docker image | |
| run: docker build -t ghcr.io/${{ github.repository }}:${{ github.ref_name }} . | |
| - name: Tag image as latest | |
| run: docker tag ghcr.io/${{ github.repository }}:${{ github.ref_name }} ghcr.io/${{ github.repository }}:latest | |
| - name: Push versioned tag to GHCR | |
| run: docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
| - name: Push latest tag to GHCR | |
| run: docker push ghcr.io/${{ github.repository }}:latest | |
| deploy: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: publish | |
| runs-on: self-hosted | |
| steps: | |
| - name: Deploy new version | |
| run: | | |
| cd /opt/homeworld | |
| docker compose pull simulacra | |
| docker compose up -d simulacra |