1
0
2025-03-04 19:41:16 -08:00

83 lines
2.0 KiB
YAML

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
typos:
name: "Typos"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check typos
uses: crate-ci/typos@master
with:
config: ./tools/typos.toml
clippy:
name: "Clippy"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: "Install Rust"
run: |
sudo apt update
DEBIAN_FRONTEND=noninteractive \
sudo apt install --yes \
rustup
- name: Run clippy
working-directory: ./tetros
run: cargo clippy --all-targets --all-features
build:
name: "Build"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: "Install Rust"
run: |
sudo apt update
DEBIAN_FRONTEND=noninteractive \
sudo apt install --yes \
rustup nasm python3-requests
- name: Build
run: make
# Upload build output
- name: "Save output"
uses: actions/upload-artifact@v3
with:
name: "Build output"
path: "build/*"
retention-days: 7
- name: "Publish package (hash)"
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
PUBLISH_USER="${{ secrets.PUBLISH_USER }}" \
PUBLISH_KEY="${{ secrets.PUBLISH_KEY }}" \
VERSION="${{ github.sha }}" \
PACKAGE="${{ vars.PACKAGE }}" \
python tools/scripts/publish.py
- name: "Publish package (latest)"
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
PUBLISH_USER="${{ secrets.PUBLISH_USER }}" \
PUBLISH_KEY="${{ secrets.PUBLISH_KEY }}" \
VERSION="latest" \
PACKAGE="${{ vars.PACKAGE }}" \
python tools/scripts/publish.py