From 75b40bbd6c3ad549ef95630caca5f25b4638f76b Mon Sep 17 00:00:00 2001 From: Paul Schifferer Date: Wed, 13 Nov 2024 08:32:55 -0800 Subject: [PATCH] Workflows --- .github/workflows/swift-ci.yml | 142 +++++++++++++++++++++++++++++++++ .github/workflows/swift-pr.yml | 39 +++++++++ 2 files changed, 181 insertions(+) create mode 100644 .github/workflows/swift-ci.yml create mode 100644 .github/workflows/swift-pr.yml diff --git a/.github/workflows/swift-ci.yml b/.github/workflows/swift-ci.yml new file mode 100644 index 0000000..ee0239e --- /dev/null +++ b/.github/workflows/swift-ci.yml @@ -0,0 +1,142 @@ +name: CI + +concurrency: ci-${{ github.ref }} + +on: + push: + branches: [develop] + paths: + - Sources/** + - Tests/** + - Package.swift + - .swift-version + workflow_dispatch: + +jobs: + tests: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Linux + os: ubuntu-20.04 + - name: macOS + os: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Get swift version + id: get_swift_version + run: | + v=$(cat .swift-version) + echo "swift_version=$v" >> $GITHUB_OUTPUT + - uses: slashmo/install-swift@v0.1.0 # swift-actions/setup-swift@v2 + with: + # swift-version: ${{ steps.get_swift_version.outputs.swift_version }} + version: ${{ steps.get_swift_version.outputs.swift_version }} + - name: Verify swift version + run: | + swift --version + - name: Build + run: | + swift build -v + - name: Run tests + run: | + swift test -v + + + # docs: + # needs: [tests] + # runs-on: ubuntu-latest + # concurrency: docs + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: "3.11" + # - name: install-deps + # run: pip install -r requirements/docs.txt + # - name: make-docs + # run: cd docs && make html + # - name: publish-docs + # uses: peaceiris/actions-gh-pages@v4 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: ./docs/_build/html + + tag: + needs: [tests] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Bump version and push tag + uses: anothrNick/github-tag-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_V: true + DEFAULT_BUMP: patch + + publish: + needs: [tag] + runs-on: ubuntu-latest + concurrency: publish + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get latest tag + id: get_latest_tag + uses: actions-ecosystem/action-get-latest-tag@v1 + # - name: Publish + # env: + # GOPROXY: proxy.golang.org + # run: go list -m github.com/sweetrpg/common@${{ steps.get_latest_tag.outputs.tag }} + + notify: + needs: [tag] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - repo: api-core + - repo: catalog-api + - repo: catalog-data + - repo: catalog-data-processor + - repo: catalog-objects + - repo: catalog-web + - repo: client + - repo: data-api + - repo: data-objects + - repo: db + - repo: initiative-api + - repo: initiative-data + - repo: initiative-objects + - repo: initiative-web + - repo: kv-api + - repo: kv-data + - repo: kv-expression-processor + - repo: kv-key-processor + - repo: kv-objects + - repo: kv-value-calculator + - repo: kv-web + - repo: library-api + - repo: library-data + - repo: library-objects + - repo: library-web + - repo: main-web + - repo: model-core + - repo: shared-web + - repo: web-core + steps: + - uses: juztcode/repo-ditpatch-action@v1 + continue-on-error: true + with: + event-type: common-published + token: ${{ secrets.REPO_ACCESS_TOKEN }} + repository: sweetrpg/${{ matrix.repo }} diff --git a/.github/workflows/swift-pr.yml b/.github/workflows/swift-pr.yml new file mode 100644 index 0000000..322c5d5 --- /dev/null +++ b/.github/workflows/swift-pr.yml @@ -0,0 +1,39 @@ +name: PR + +on: + push: + branches: [develop] + workflow_dispatch: + +jobs: + tests: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Linux + os: ubuntu-20.04 + - name: macOS + os: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Get swift version + id: get_swift_version + run: | + v=$(cat .swift-version) + echo "swift_version=$v" >> $GITHUB_OUTPUT + - uses: slashmo/install-swift@v0.1.0 # swift-actions/setup-swift@v2 + with: + # swift-version: ${{ steps.get_swift_version.outputs.swift_version }} + version: ${{ steps.get_swift_version.outputs.swift_version }} + - name: Verify swift version + run: | + swift --version + - name: Build + run: | + swift build -v + - name: Run tests + run: | + swift test -v