From d913316057c73d6e6d7791edeb545671774c8b80 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 9 Sep 2022 12:02:43 -0700 Subject: [PATCH] Add gha --- .cargo/config.toml | 2 + .github/dependabot.yml | 10 ++++ .github/workflows/ci.yml | 112 +++++++++++++++++++++++++++++++++++ .github/workflows/update.yml | 19 ++++++ 4 files changed, 143 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/update.yml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..c252d7f --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +rustflags=["--cfg", "tracing_unstable"] \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..13b4ef5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..31bf1f7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,112 @@ +name: CI + +on: + pull_request: + push: + branches: [main] + +jobs: + Format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Check rustfmt + run: nix develop --command ci-check-rustfmt + + Spelling: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Check Spelling + run: nix develop --command ci-check-spelling + + NixFormatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Check nixpkgs-fmt formatting + run: nix develop --command ci-check-nixpkgs-fmt + + RegistryFormatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Check registry.json formatting + run: nix develop --command ci-check-registry-format + + EditorConfig: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Check EditorConfig conformance + run: nix develop --command ci-check-editorconfig + + Test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Run tests + run: nix develop --command ci-test-rust + # run: nix develop -c -- cargo test -- --include-ignored + + BuildX86Linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + # Runs clippy as part of the preBuild. + - name: Build harmonic + run: nix build .#packages.x86_64-linux.harmonic -L + - name: Build harmonicStatic + run: nix build .#packages.x86_64-linux.harmonicStatic -L + - name: Create artifact for x86_64-linux harmonicStatic + uses: actions/upload-artifact@v3 + with: + name: harmonic-x86_64-linux + path: | + result/bin/harmonic + + BuildX86Darwin: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + # Runs clippy as part of the preBuild. + - name: Build harmonic + run: nix build .#packages.x86_64-darwin.harmonic -L + - name: Create artifact for x86_64-darwin harmonic + uses: actions/upload-artifact@v3 + with: + name: harmonic-x86_64-darwin + path: | + result/bin/harmonic diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..06a571f --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,19 @@ +name: update-flake-lock +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * 0' + +jobs: + lockfile: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Nix + uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Update flake.lock + uses: DeterminateSystems/update-flake-lock@v13