aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/test.yaml39
-rw-r--r--README.md1
-rw-r--r--crates/shirabe/tests/installer_test.rs3
-rwxr-xr-xcrates/shirabe/tests/plugin/fixtures/e2e-installers/fetch1
-rwxr-xr-xcrates/shirabe/tests/plugin/fixtures/e2e-normalize/fetch1
-rwxr-xr-xcrates/shirabe/tests/plugin/fixtures/e2e/fetch1
-rw-r--r--docs/known-incompatibilities.md2
-rw-r--r--flake.lock10
-rw-r--r--flake.nix4
-rw-r--r--justfile33
10 files changed, 85 insertions, 10 deletions
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644
index 00000000..27f545a5
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,39 @@
+name: Test
+
+on:
+ push:
+ branches: [main]
+
+jobs:
+ format:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: cachix/install-nix-action@v25
+ with:
+ nix_path: nixpkgs=channel:nixos-unstable
+
+ - run: nix fmt -- --ci
+
+ tests:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: true
+
+ - uses: cachix/install-nix-action@v25
+ with:
+ nix_path: nixpkgs=channel:nixos-unstable
+
+ - uses: actions/cache@v4
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ target
+ key: cargo-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}-${{ github.sha }}
+ restore-keys: cargo-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}-
+
+ - run: nix develop --command just check
diff --git a/README.md b/README.md
index 12638649..ba84d1ba 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,7 @@ Building Shirabe requires:
* Git
* PHP
* Composer
+* Just (optional)
* Nix (optional)
* Direnv (optional)
diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs
index 6907758c..922fbd45 100644
--- a/crates/shirabe/tests/installer_test.rs
+++ b/crates/shirabe/tests/installer_test.rs
@@ -376,6 +376,7 @@ fn make_packages_comparable(
#[test]
#[serial]
fn test_installer() {
+ bootstrap::bootstrap();
let _tear_down = TearDown::new();
for case in provide_installer() {
@@ -842,6 +843,8 @@ fn write_json(path: &std::path::Path, value: &serde_json::Value) {
/// ref: InstallerTest::doTestIntegration
fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
+ bootstrap::bootstrap();
+
if let Some(condition) = &case.condition
&& !evaluate_condition(condition)
{
diff --git a/crates/shirabe/tests/plugin/fixtures/e2e-installers/fetch b/crates/shirabe/tests/plugin/fixtures/e2e-installers/fetch
index a00d9a07..ca7fa167 100755
--- a/crates/shirabe/tests/plugin/fixtures/e2e-installers/fetch
+++ b/crates/shirabe/tests/plugin/fixtures/e2e-installers/fetch
@@ -18,7 +18,6 @@ ext="$(dirname "$0")/ext"
dir="$ext/composer-installers-2.3.0"
if [ -f "$dir/src/Composer/Installers/Installer.php" ]; then
- echo "already fetched: $dir"
exit 0
fi
diff --git a/crates/shirabe/tests/plugin/fixtures/e2e-normalize/fetch b/crates/shirabe/tests/plugin/fixtures/e2e-normalize/fetch
index 7fb7cd5a..9a7ea827 100755
--- a/crates/shirabe/tests/plugin/fixtures/e2e-normalize/fetch
+++ b/crates/shirabe/tests/plugin/fixtures/e2e-normalize/fetch
@@ -16,7 +16,6 @@ tree_hash() {
while read -r dir repo commit hash; do
target="$base/$dir"
if [ -d "$target" ]; then
- echo "already fetched: $target"
continue
fi
mkdir -p "$target"
diff --git a/crates/shirabe/tests/plugin/fixtures/e2e/fetch b/crates/shirabe/tests/plugin/fixtures/e2e/fetch
index a4179955..a7adcb75 100755
--- a/crates/shirabe/tests/plugin/fixtures/e2e/fetch
+++ b/crates/shirabe/tests/plugin/fixtures/e2e/fetch
@@ -11,7 +11,6 @@ commit=85e90b3942d06b2326fba0403ec24fe912372936
dir="$(dirname "$0")/ext/phpstan-extension-installer-1.4.3"
if [ -f "$dir/src/Plugin.php" ]; then
- echo "already fetched: $dir"
exit 0
fi
diff --git a/docs/known-incompatibilities.md b/docs/known-incompatibilities.md
index 145e2992..e0a94084 100644
--- a/docs/known-incompatibilities.md
+++ b/docs/known-incompatibilities.md
@@ -8,7 +8,7 @@ NOTE: This is not an exhaustive list. Shirabe is in early development and there
We plan to support all platforms that Composer does, but currently:
* Linux: fully supported and tested
-* macOS: not well tested
+* macOS: unsupported
* Windows: unsupported
diff --git a/flake.lock b/flake.lock
index 186ecf72..76841d03 100644
--- a/flake.lock
+++ b/flake.lock
@@ -67,16 +67,16 @@
},
"systems": {
"locked": {
- "lastModified": 1680978846,
- "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
- "repo": "x86_64-linux",
- "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
- "repo": "x86_64-linux",
+ "repo": "default",
"type": "github"
}
},
diff --git a/flake.nix b/flake.nix
index 57955bc2..df1d0c3a 100644
--- a/flake.nix
+++ b/flake.nix
@@ -4,7 +4,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- systems.url = "github:nix-systems/x86_64-linux";
+ systems.url = "github:nix-systems/default";
flake-utils = {
url = "github:numtide/flake-utils";
@@ -50,6 +50,8 @@
packages = [
rustToolchain
pkgs.php85
+ pkgs.php85Packages.composer
+ pkgs.just
# The following softwares are used for testing.
# VCSs
diff --git a/justfile b/justfile
new file mode 100644
index 00000000..5978c11f
--- /dev/null
+++ b/justfile
@@ -0,0 +1,33 @@
+help:
+ @just --list
+
+check: lint clippy test
+
+lint: setup
+ ./scripts/linters/lint
+
+clippy: setup
+ cargo clippy --tests
+
+test: setup
+ cargo test
+
+fmt:
+ nix fmt
+
+setup: fetch-fixtures
+ #!/usr/bin/env bash
+ set -euo pipefail
+ if [[ ! -f composer/vendor/autoload.php ]]; then
+ composer install --no-dev --working-dir=composer
+ fi
+ if [[ ! -f scripts/linters/vendor/autoload.php ]]; then
+ composer install --working-dir=scripts/linters
+ fi
+
+fetch-fixtures:
+ #!/usr/bin/env bash
+ set -euo pipefail
+ for fetch in crates/shirabe/tests/plugin/fixtures/*/fetch; do
+ "$fetch"
+ done