Files
stationeers_lang/.gitea/workflows/build.yml
Devin Bidwell e83ff67af8
All checks were successful
CI/CD Pipeline / test (pull_request) Successful in 34s
CI/CD Pipeline / build (pull_request) Has been skipped
CI/CD Pipeline / release (pull_request) Has been skipped
Fix for Gitea actions
2025-12-21 16:42:29 -07:00

106 lines
3.0 KiB
YAML

name: CI/CD Pipeline
# Trigger conditions
on:
push:
branches: ["master"]
tags: ["*.*.*"]
pull_request:
branches: ["master"]
jobs:
# JOB 1: RUN TESTS
# This runs on every PR and every push to master.
# It validates that the Rust code is correct.
test:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
# 1. Build the Docker Image (Cached)
- name: Build Docker Image
run: docker build -t slang-builder -f Dockerfile.build .
# 2. Run Rust Tests
# --manifest-path: Point to the nested Cargo.toml
# --workspace: Test all crates (compiler, parser, tokenizer, helpers)
# --all-targets: Test lib, bin, and tests folder (skips doc-tests because they are not valid Rust)
- name: Run Rust Tests
run: |
docker run --rm \
-u $(id -u):$(id -g) \
-v "$PWD":/app \
-e HOME=/tmp \
slang-builder \
cargo test --manifest-path rust_compiler/Cargo.toml --workspace --all-targets
build:
needs: test
runs-on: self-hosted
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
# 1. Build Image (Fast, uses cache from previous job if available/local)
- name: Build Docker Image
run: docker build -t slang-builder -f Dockerfile.build .
# 2. Run the Build Script
# Mounts the references from the server's secure storage
- name: Build Release Artifacts
run: |
docker run --rm \
-u $(id -u):$(id -g) \
-v "$PWD":/app \
-v "/home/github-runner/permanent-refs":/app/csharp_mod/ref \
-e HOME=/tmp \
slang-builder \
./build.sh
- name: Zip Workshop Folder
run: |
zip -r release/workshop.zip release/workshop/
# 3. Fix Permissions
# Docker writes files as root. We need to own them to upload them.
- name: Fix Permissions
if: always()
run: chown -R $USER:$USER release/
# 4. Upload to GitHub
- name: Upload Release Artifacts
uses: actions/upload-artifact@v3
with:
name: StationeersSlang-Release
path: release/
release:
needs: build
runs-on: self-hosted
# ONLY run this job if we pushed a tag (e.g., v1.0.1)
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
# We download the artifact from the previous 'build' job
- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
name: StationeersSlang-Release
path: ./release-files
- name: Create Gitea Release
uses: https://gitea.com/actions/gitea-release-action@v1
with:
files: |
./release-files/workshop.zip
./release-files/slang
./release-files/slang.exe
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}