diff --git a/.github/workflows/plane2-build-image.yml b/.github/workflows/plane2-build-image.yml new file mode 100644 index 000000000..4ea4ea990 --- /dev/null +++ b/.github/workflows/plane2-build-image.yml @@ -0,0 +1,66 @@ +name: Build Docker Image + +on: + push: + branches: [ "plane2-preview" ] + # tags: [ 'v*.*.*' ] + paths-ignore: [ "/docs" ] + + pull_request: + branches: [ "plane2-preview" ] + paths: + # Unless the Dockerfile itself has changed, testing whether a build passes + # on a PR doesn’t tell us much that faster CI/CD workflows don’t already. + - '.github/workflows/build-image.yml' + - 'docker/Dockerfile' + +env: + IMAGE_NAME: plane/plane-preview + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Depot + uses: depot/setup-action@v1 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + - name: Log into registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short + type=semver,pattern={{version}} + type=raw,value=latest + + - name: Build and push Docker image + id: build-and-push + uses: depot/build-push-action@v1 + with: + context: "." + file: "docker/Dockerfile" + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'drifting-in-space/plane' && 'linux/amd64' || 'linux/amd64,linux/arm64' }} + buildx-fallback: true + project: 58j0517pw2 diff --git a/.github/workflows/plane2-clippy.yml b/.github/workflows/plane2-clippy.yml new file mode 100644 index 000000000..c77c0774e --- /dev/null +++ b/.github/workflows/plane2-clippy.yml @@ -0,0 +1,15 @@ +on: + pull_request: + branches: [ "plane2-preview" ] + +name: Clippy check +jobs: + check-rust-clippy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features diff --git a/.github/workflows/plane2-rustfmt.yml b/.github/workflows/plane2-rustfmt.yml new file mode 100644 index 000000000..3c205f34f --- /dev/null +++ b/.github/workflows/plane2-rustfmt.yml @@ -0,0 +1,18 @@ +name: Check Rust formatting + +on: + pull_request: + branches: [ "plane2-preview" ] + +jobs: + check-rust-format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt + override: true + - name: Check format + run: cargo fmt -- --check diff --git a/.github/workflows/plane2-tests.yml b/.github/workflows/plane2-tests.yml new file mode 100644 index 000000000..0c4a2badb --- /dev/null +++ b/.github/workflows/plane2-tests.yml @@ -0,0 +1,32 @@ +name: Tests + +on: + push: + branches: [ plane2-preview ] + pull_request: + branches: [ plane2-preview ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest-16-cores + + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + + - name: Install cargo-nextest + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + + - name: Run tests + run: cargo nextest run + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: test-scratch + path: test-scratch