Skip to content

Merge pull request #18 from ejir/feat-emoticons-popup-categorized-tabs #42

Merge pull request #18 from ejir/feat-emoticons-popup-categorized-tabs

Merge pull request #18 from ejir/feat-emoticons-popup-categorized-tabs #42

Workflow file for this run

name: CI Build and Test
on:
push:
branches: [ main, develop, github-actions-ci-build-test ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
build:
name: Build with Cosmopolitan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y wget unzip build-essential
- name: Cache Cosmopolitan toolchain
id: cache-cosmo
uses: actions/cache@v4
with:
path: /opt/cosmo
key: cosmo-toolchain-v1
- name: Install Cosmopolitan toolchain
if: steps.cache-cosmo.outputs.cache-hit != 'true'
run: |
sudo mkdir -p /opt/cosmo
cd /opt/cosmo
sudo wget -q https://cosmo.zip/pub/cosmocc/cosmocc.zip
sudo unzip -q cosmocc.zip
sudo rm cosmocc.zip
sudo chmod +x bin/cosmocc bin/cosmoar
echo "Cosmopolitan toolchain installed"
- name: Verify Cosmopolitan installation
run: |
ls -lh /opt/cosmo/bin/
/opt/cosmo/bin/cosmocc --version || echo "Cosmocc installed"
- name: Build with Cosmopolitan
run: |
make BUILD_MODE=cosmo
- name: Verify APE build artifact
run: |
ls -lh app.com
file app.com
chmod +x app.com
- name: Upload Cosmopolitan APE artifact
uses: actions/upload-artifact@v4
with:
name: app-cosmopolitan-ape
path: app.com
retention-days: 30
test:
name: Run Tests
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y wget unzip build-essential
- name: Cache Cosmopolitan toolchain
id: cache-cosmo
uses: actions/cache@v4
with:
path: /opt/cosmo
key: cosmo-toolchain-v1
- name: Install Cosmopolitan toolchain
if: steps.cache-cosmo.outputs.cache-hit != 'true'
run: |
sudo mkdir -p /opt/cosmo
cd /opt/cosmo
sudo wget -q https://cosmo.zip/pub/cosmocc/cosmocc.zip
sudo unzip -q cosmocc.zip
sudo rm cosmocc.zip
sudo chmod +x bin/cosmocc bin/cosmoar
- name: Build and run tests with Cosmopolitan
run: |
make BUILD_MODE=cosmo test
- name: Verify test artifacts
run: |
ls -lh obj/test_* || echo "Test binaries built"
echo "All tests passed!"
integration:
name: Integration Test
runs-on: ubuntu-latest
needs: [build, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Cosmopolitan APE artifact
uses: actions/download-artifact@v4
with:
name: app-cosmopolitan-ape
- name: Make executable
run: chmod +x app.com
- name: Run application in background
run: |
./app.com > app.log 2>&1 &
APP_PID=$!
echo "APP_PID=$APP_PID" >> $GITHUB_ENV
echo "Application started with PID: $APP_PID"
- name: Wait for application to start
run: |
sleep 5
echo "Application logs:"
cat app.log || echo "No logs yet"
- name: Test HTTP endpoint
run: |
# Try to connect to the application
curl -f http://localhost:8080/ || echo "Application may not be ready"
- name: Stop application
if: always()
run: |
if [ -n "$APP_PID" ]; then
kill $APP_PID || true
fi
pkill -f './app.com' || true
- name: Upload application logs
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-logs
path: app.log
retention-days: 7
release:
name: Create Release Artifacts
runs-on: ubuntu-latest
needs: [build, test]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Cosmopolitan APE
uses: actions/download-artifact@v4
with:
name: app-cosmopolitan-ape
- name: Prepare release artifacts
run: |
mkdir -p release
mv app.com release/app.com
chmod +x release/app.com
- name: Create checksums
run: |
cd release
sha256sum app.com > SHA256SUMS
cat SHA256SUMS
- name: Upload release bundle
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: release/
retention-days: 90
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
release/app.com
release/SHA256SUMS
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}