Merge pull request #969 from openmeterio/dependabot/go_modules/github… #2533
This file contains 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] | |
pull_request: | |
permissions: | |
contents: read | |
env: | |
DAGGER_VERSION: 0.11.6 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Set up magic Nix cache | |
uses: DeterminateSystems/magic-nix-cache-action@87e8236f46702ab0ce5a058b605a173ec88d618e # v6 | |
- name: Prepare Nix shell | |
run: nix develop --impure .#ci | |
- name: Build Server | |
run: nix develop --impure .#ci -c make build-server | |
- name: Build Sink Worker | |
run: nix develop --impure .#ci -c make build-sink-worker | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run pipeline | |
uses: dagger/dagger-for-github@158efd19b6af5ff000289d6c7c507ada3c7b3b9b # v5.8.0 | |
with: | |
verb: call | |
module: github.com/${{ github.repository }}@${{ github.ref }} | |
args: --ref ${{ github.ref }} test | |
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
version: ${{ env.DAGGER_VERSION }} | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run pipeline | |
uses: dagger/dagger-for-github@158efd19b6af5ff000289d6c7c507ada3c7b3b9b # v5.8.0 | |
with: | |
verb: call | |
module: github.com/${{ github.repository }}@${{ github.ref }} | |
args: --ref ${{ github.ref }} lint all | |
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
version: ${{ env.DAGGER_VERSION }} | |
commit-hooks: | |
name: Commit hooks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
fetch-depth: 0 | |
- name: Free disk space | |
uses: ./.github/actions/free-disk-space | |
- name: Set up Nix | |
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Set up magic Nix cache | |
uses: DeterminateSystems/magic-nix-cache-action@87e8236f46702ab0ce5a058b605a173ec88d618e # v6 | |
- name: Prepare Nix shell | |
run: nix develop --impure .#ci | |
- name: Pre-commit hooks | |
run: nix develop --impure .#ci -c pre-commit run -a | |
- name: Check commit messages | |
run: nix develop --impure .#ci -c pre-commit run --hook-stage manual | |
dev: | |
name: Developer environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Set up magic Nix cache | |
uses: DeterminateSystems/magic-nix-cache-action@87e8236f46702ab0ce5a058b605a173ec88d618e # v6 | |
- name: Check | |
run: nix flake check --impure | |
- name: Dev shell | |
run: nix develop --impure | |
artifacts: | |
name: Artifacts | |
uses: ./.github/workflows/artifacts.yaml | |
with: | |
publish: ${{ github.event_name == 'push' }} | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
security-events: write | |
dependency-review: | |
name: Dependency review | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Dependency Review | |
uses: actions/dependency-review-action@0c155c5e8556a497adf53f2c18edabf945ed8e70 # v4.3.2 | |
fossa-scan: | |
name: FOSSA Scan | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Run FOSSA Scan | |
uses: fossas/fossa-action@47ef11b1e1e3812e88dae436ccbd2d0cbd1adab0 # v1.3.3 | |
with: | |
api-key: ${{secrets.FOSSA_API_KEY}} | |
quickstart: | |
name: Quickstart | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Launch Docker Compose | |
run: docker compose -f docker-compose.yaml -f docker-compose.ci.yaml up -d | |
working-directory: quickstart | |
- name: Wait for worker to become ready | |
run: curl --retry 10 --retry-max-time 120 --retry-all-errors http://localhost:10000/healthz | |
- name: Run tests | |
uses: dagger/dagger-for-github@158efd19b6af5ff000289d6c7c507ada3c7b3b9b # v5.8.0 | |
with: | |
verb: call | |
args: --source .:default quickstart-test --service tcp://localhost:8888 --port 8888 | |
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
version: ${{ env.DAGGER_VERSION }} | |
- name: Cleanup Docker Compose | |
run: docker compose -f docker-compose.yaml -f docker-compose.ci.yaml down -v | |
working-directory: quickstart | |
if: always() | |
e2e: | |
name: E2E | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free Disk Space | |
uses: jlumbroso/[email protected] | |
with: | |
# Runs quick, run rm in background | |
tool-cache: true | |
# These run slower as use apt to uninstall packages | |
# Turned on by default, so we disable them | |
android: false | |
dotnet: false | |
haskell: false | |
large-packages: false | |
docker-images: false | |
swap-storage: false | |
- name: Run pipeline | |
uses: dagger/dagger-for-github@158efd19b6af5ff000289d6c7c507ada3c7b3b9b # v5.8.0 | |
with: | |
verb: call | |
module: github.com/${{ github.repository }}@${{ github.ref }} | |
args: --ref ${{ github.ref }} etoe | |
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
version: ${{ env.DAGGER_VERSION }} | |
dagger: | |
name: CI | |
runs-on: ${{ github.actor == 'dependabot[bot]' && 'ubuntu-latest' || 'ubuntu-latest-large' }} | |
steps: | |
- name: Free Disk Space | |
uses: jlumbroso/[email protected] | |
with: | |
# Runs quick, run rm in background | |
tool-cache: true | |
# These run slower as use apt to uninstall packages | |
# Turned on by default, so we disable them | |
android: false | |
dotnet: false | |
haskell: false | |
large-packages: false | |
docker-images: false | |
swap-storage: false | |
- name: Run pipeline | |
uses: dagger/dagger-for-github@158efd19b6af5ff000289d6c7c507ada3c7b3b9b # v5.8.0 | |
with: | |
verb: call | |
module: github.com/${{ github.repository }}@${{ github.ref }} | |
args: --ref ${{ github.ref }} ci | |
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
version: ${{ env.DAGGER_VERSION }} |