Begin 0.10.1-dev development #106
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release/* | |
| paths: | |
| - VERSION | |
| - server/** | |
| - cli/** | |
| - adapters/python/** | |
| - tests/** | |
| - Dockerfile | |
| - .github/workflows/ci.yml | |
| pull_request: | |
| paths: | |
| - VERSION | |
| - server/** | |
| - cli/** | |
| - adapters/python/** | |
| - tests/** | |
| - Dockerfile | |
| - .github/workflows/ci.yml | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ci-check-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Erlang/Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: "27" | |
| elixir-version: "1.18" | |
| - name: Check Elixir formatting | |
| working-directory: server | |
| run: mix format --check-formatted | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: cli/go.mod | |
| cache-dependency-path: cli/go.sum | |
| - name: Check Go formatting | |
| working-directory: cli | |
| run: | | |
| unformatted=$(gofmt -l .) | |
| if [ -n "$unformatted" ]; then | |
| echo "Files not formatted:" | |
| echo "$unformatted" | |
| exit 1 | |
| fi | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Check Python formatting and linting | |
| working-directory: adapters/python | |
| run: | | |
| uvx ruff format --check . | |
| uvx ruff check . | |
| - name: Check version consistency | |
| shell: python3 {0} | |
| run: | | |
| import tomllib, re | |
| from pathlib import Path | |
| version = Path("VERSION").read_text().strip() | |
| # Convert to PEP 440: 0.9.0-dev -> 0.9.0.dev0 | |
| pep440 = re.sub(r"-dev$", ".dev0", version) | |
| with open("adapters/python/pyproject.toml", "rb") as f: | |
| adapter_version = tomllib.load(f)["project"]["version"] | |
| if pep440 != adapter_version: | |
| raise SystemExit( | |
| f"Version mismatch: VERSION is {version} (PEP 440: {pep440}), " | |
| f"but adapters/python/pyproject.toml is {adapter_version}" | |
| ) | |
| print(f"Versions consistent: {version} / {adapter_version}") | |
| - name: Lint changelogs | |
| run: python3 scripts/lint-changelog.py server/CHANGELOG.md cli/CHANGELOG.md adapters/python/CHANGELOG.md | |
| build-cli: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| - goos: darwin | |
| goarch: amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: cli/go.mod | |
| cache-dependency-path: cli/go.sum | |
| - name: Get version | |
| id: version | |
| run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" | |
| - name: Build | |
| working-directory: cli | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: go build -ldflags "-X github.com/bitroot/coflux/cli/internal/version.Version=$VERSION" -o "coflux-${GOOS}-${GOARCH}" ./cmd/coflux | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coflux-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: cli/coflux-* | |
| build-server: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ci-build-server-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| load: true | |
| tags: coflux:ci | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Save image | |
| run: docker save coflux:ci | gzip > /tmp/coflux-image.tar.gz | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coflux-image | |
| path: /tmp/coflux-image.tar.gz | |
| build-adapter: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Build | |
| run: uv build | |
| working-directory: adapters/python | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-adapter | |
| path: adapters/python/dist/* | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: [build-cli] | |
| timeout-minutes: 15 | |
| concurrency: | |
| group: ci-test-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Erlang/Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: "27" | |
| elixir-version: "1.18" | |
| - name: Cache Mix dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| server/deps | |
| server/_build | |
| key: mix-${{ runner.os }}-${{ hashFiles('server/mix.lock') }} | |
| restore-keys: mix-${{ runner.os }}- | |
| - name: Compile server | |
| working-directory: server | |
| run: mix deps.get && mix compile | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Download CLI artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: coflux-linux-amd64 | |
| path: cli | |
| - name: Make CLI executable | |
| run: chmod +x cli/coflux-linux-amd64 | |
| - name: Install test dependencies | |
| run: pip install pytest pytest-xdist PyJWT cryptography | |
| - name: Run E2E tests | |
| env: | |
| COFLUX_BIN: cli/coflux-linux-amd64 | |
| run: pytest tests/ -n auto |