From 69f3921a689ce96f5d89a6cfe7f9610a8780517e Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Mon, 11 Jan 2021 18:21:32 +0100 Subject: [PATCH 1/2] Switch CI from Travis to GitHub Actions --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 -- .travis.yml | 28 --------------------------- README.md | 4 ++-- 4 files changed, 44 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..544e4f20 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + pull_request: + branches: + # Branches from forks have the form 'user:branch-name' so we only run + # this job on pull_request events for branches that look like fork + # branches. Without this we would end up running this job twice for non + # forked PRs, once for the push and then once for opening the PR. + - "**:**" + schedule: + - cron: "0 3 * * 1" # Every monday at 3 AM + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + crystal: [latest, nightly] + runs-on: ${{ matrix.os }} + + steps: + - name: Install Crystal + uses: oprypin/install-crystal@v1 + with: + crystal: ${{ matrix.crystal }} + + - name: Download source + uses: actions/checkout@v2 + + - name: Install dependencies + run: shards install + env: + SHARDS_OPTS: --ignore-crystal-version + + - name: Run specs + run: make test + + - name: Check formatting + run: crystal tool format --check diff --git a/.gitignore b/.gitignore index dddc937e..2e28b915 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,3 @@ # Libraries don't need dependency lock # Dependencies will be locked in application that uses them /shard.lock - -*.html \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5de00985..00000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: crystal - -crystal: - - latest - - nightly - -jobs: - allow_failures: - - crystal: nightly - -install: - - shards install - -script: - - make test - - crystal tool format --check - - sed -i -e 's:<.*>::g' README.md - - crystal docs - -deploy: - provider: pages - github_token: $GITHUB_TOKEN - project_name: ameba - skip_cleanup: true - on: - branch: master - local_dir: docs - verbose: true diff --git a/README.md b/README.md index 422776df..b901259a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@

- + @@ -169,7 +169,7 @@ In this example we define default globs and exclude `src/compiler` folder: Globs: - **/*.cr - !lib - + Excluded: - src/compiler ``` From d20952127a1f7586a2dc273e02b4a4f64fff97ad Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Mon, 11 Jan 2021 18:33:32 +0100 Subject: [PATCH 2/2] Add deploy docs workflow --- .github/workflows/docs.yml | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..14b60f5f --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,54 @@ +name: Docs + +on: + push: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Install Crystal + uses: oprypin/install-crystal@v1 + + - name: Download source + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Install dependencies + run: shards install + env: + SHARDS_OPTS: --ignore-crystal-version + + - name: Build docs + run: | + sed -i -e 's:<.*>::g' README.md + crystal docs --project-version="${{ env.GITHUB_REF_SLUG }}" --source-refname="${{ env.GITHUB_SHA_SHORT }}" + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: docs + path: docs + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: docs + path: docs + + - name: Deploy docs 🚀 + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: docs + CLEAN: true