Summary
Create a CI workflow that runs tests for all 4 languages on every PR and push to main.
Prerequisites
Instructions
Create .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: \${{ matrix.python-version }}
- run: pip install pyyaml pytest
working-directory: python
- run: pytest tests/ -v
working-directory: python
nodejs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18', '20', '22']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: \${{ matrix.node-version }}
- run: npm install
working-directory: nodejs
- run: npm test
working-directory: nodejs
golang:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.21', '1.22', '1.23']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: \${{ matrix.go-version }}
- run: go vet ./...
working-directory: golang
- run: go test -v ./...
working-directory: golang
java:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: ['11', '17', '21']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: \${{ matrix.java-version }}
distribution: 'temurin'
- run: mvn test -B
working-directory: java
Also create .gitignore in repo root
# Python
python/__pycache__/
python/*.egg-info/
python/.venv/
python/dist/
python/build/
# Node.js
nodejs/node_modules/
# Go
golang/vendor/
# Java
java/target/
# IDE
.idea/
.vscode/
*.iml
# OS
.DS_Store
Thumbs.db
Verification
- Push a PR and verify all 4 language jobs run and pass
- Matrix produces 3 versions × 4 languages = 12 jobs
.gitignore prevents build artifacts from being committed
Summary
Create a CI workflow that runs tests for all 4 languages on every PR and push to main.
Prerequisites
Instructions
Create
.github/workflows/ci.ymlAlso create
.gitignorein repo rootVerification
.gitignoreprevents build artifacts from being committed