From 0c2b518b945e9c1069a1334466032601fcb42a54 Mon Sep 17 00:00:00 2001 From: Andrei Malashkin Date: Tue, 3 Sep 2024 13:17:35 +0200 Subject: [PATCH] add ci --- .github/workflows/linux-nix-check.yml | 24 +++++++++++++++++++++ .github/workflows/mac-nix-check.yml | 26 +++++++++++++++++++++++ .github/workflows/pull-request.yml | 30 +++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 .github/workflows/linux-nix-check.yml create mode 100644 .github/workflows/mac-nix-check.yml create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/linux-nix-check.yml b/.github/workflows/linux-nix-check.yml new file mode 100644 index 0000000000..147f7fc2dd --- /dev/null +++ b/.github/workflows/linux-nix-check.yml @@ -0,0 +1,24 @@ +name: Build and Test on Linux Platforms + +on: + workflow_call: + +jobs: + build-and-test: + name: "Build and test Linux" + runs-on: [self-hosted, Linux, X64, aws_autoscaling] + steps: + # https://github.com/actions/checkout/issues/1552 + - name: Clean up after previous checkout + run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*; + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Run checks + run: nix flake -L check + env: + NIX_CONFIG: | + cores = 6 diff --git a/.github/workflows/mac-nix-check.yml b/.github/workflows/mac-nix-check.yml new file mode 100644 index 0000000000..99fb449563 --- /dev/null +++ b/.github/workflows/mac-nix-check.yml @@ -0,0 +1,26 @@ +name: Crypto3 Build and Test on macOS Platforms + +on: + workflow_call: + +jobs: + build-and-test: + name: "Build and test macOS" + runs-on: [macos-14] + steps: + - name: Checkout Crypto3 + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # From https://github.com/DeterminateSystems/magic-nix-cache-action + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: DeterminateSystems/flake-checker-action@main + + - name: Run checks + run: nix flake -L check + env: + NIX_CONFIG: | + cores = 0 + max-jobs = 1 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000000..950321c399 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,30 @@ +name: PR Testing + +on: + pull_request: + push: + branches: + - master + +concurrency: + # In master we want to run for every commit, in other branches — only for the last one + group: ${{ + ( github.ref == 'refs/heads/master' && format('{0}/{1}/{2}', github.workflow, github.ref, github.sha) ) + || + format('{0}/{1}', github.workflow, github.ref) }} + cancel-in-progress: true + +jobs: + test-linux: + name: Linux Crypto3 Testing + uses: ./.github/workflows/linux-nix-check.yml + if: | + always() && !cancelled() + secrets: inherit + + test-mac: + name: macOS Crypto3 Testing + uses: ./.github/workflows/mac-nix-check.yml + if: | + always() && !cancelled() + secrets: inherit