diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df84f0f..d59ab36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,25 +1,62 @@ -name: CI - on: push: - branches: - - '**' workflow_dispatch: null +name: CI + jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: nicknovitski/nix-develop@v1 + - name: Lint with flake8 + run: | + flake8 --version + flake8 + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: nicknovitski/nix-develop@v1 + - name: Build + run: | + python -m build + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist test: runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: nicknovitski/nix-develop@v1 + - uses: actions/download-artifact@v4 + with: + name: dist + path: tests/dist + - name: Integration tests + run: | + cd tests + pytest + release: + name: Create Release + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + environment: release + needs: [lint, test] + permissions: + id-token: write steps: - - uses: actions/checkout@v2 - - uses: DeterminateSystems/nix-installer-action@main - - uses: nicknovitski/nix-develop@v1 - - name: Lint with flake8 - run: | - cd src - flake8 --version - flake8 - - name: Test with pytest - run: | - cd src/tests - pytest --version - pytest + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Publish to PyPi + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 2e6691f..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,58 +0,0 @@ -on: - push: - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - workflow_dispatch: null - -name: Create Release - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: DeterminateSystems/nix-installer-action@main - - uses: nicknovitski/nix-develop@v1 - - name: Lint with flake8 - run: | - cd src - flake8 --version - flake8 - - name: Test with pytest - run: | - cd src/tests - pytest --version - pytest - release: - name: Create Release - runs-on: ubuntu-latest - environment: release - needs: test - permissions: - id-token: write - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: | - pip install -U setuptools wheel twine - - name: Build - run: | - cd src - python setup.py sdist bdist_wheel - - name: Publish to PyPi - uses: pypa/gh-action-pypi-publish@release/v1 - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false diff --git a/flake.nix b/flake.nix index c7597bf..fe4efcf 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,7 @@ packages = with pkgs;[ podman-compose (python3.withPackages (ps: with ps; [ + build pytest flake8 requests