|
| 1 | +--- |
| 2 | +name: Continuous Integration |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - refs/tags/*_staging |
| 7 | + - refs/tags/*_production |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ubuntu-18.04 |
| 11 | + steps: |
| 12 | + - name: Checkout branch |
| 13 | + uses: actions/checkout@v2 |
| 14 | + - name: Extract branch name |
| 15 | + shell: bash |
| 16 | + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" |
| 17 | + id: extract_branch |
| 18 | + - name: Cache gems |
| 19 | + uses: actions/cache@v2 |
| 20 | + with: |
| 21 | + path: vendor/bundle |
| 22 | + key: "${{ runner.OS }}-gem-cache-${{ hashFiles('**/*.gemspec') |
| 23 | + }}" |
| 24 | + restore-keys: "${{ runner.OS }}-gem-cache-\n" |
| 25 | + - uses: "cachix/install-nix-action@8d6d5e949675fbadb765c6b1a975047fa5f09b27" |
| 26 | + with: |
| 27 | + extra_nix_config: | |
| 28 | + post-build-hook = /etc/nix/upload-to-cache.sh |
| 29 | + substituters = https://cache.nixos.org/ |
| 30 | + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= |
| 31 | + nix_path: nixpkgs=channel:nixos-21.05 |
| 32 | + - name: Run CI through nix-shell |
| 33 | + env: |
| 34 | + GEMFURY_DEPLOY_TOKEN: ${{ secrets.GEMFURY_DEPLOY_TOKEN }} |
| 35 | + run: nix-shell --run "chmod 755 ./run_ci.sh && ./run_ci.sh" |
| 36 | + - name: Post to Slack if build fails |
| 37 | + if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' |
| 38 | + || github.ref == 'refs/heads/stable') |
| 39 | + uses: pullreminders/slack-action@a5a262c896a1cc80dcbae59ba95513e2dfb21439 |
| 40 | + env: |
| 41 | + SLACK_BOT_TOKEN: "${{ secrets.SLACK_BOT_TOKEN }}" |
| 42 | + with: |
| 43 | + args: '{\"channel\":\"C33574SJJ\",\"text\":\"* ${{ github.repository }} BUILD |
| 44 | + FAILURE*\", \"attachments\": [{ \"fallback\": \"Failure summary\", \"color\": |
| 45 | + \"#ff0000\", \"fields\": [{\"title\": \"Branch\", \"value\":\"${{ steps.extract_branch.outputs.branch |
| 46 | + }}\"}, {\"title\": \"Who broke it\", \"value\":\"${{ github.actor }}\"}, |
| 47 | + { \"title\": \"Build output\", \"value\": \"https://github.com/${{ github.repository |
| 48 | + }}/commit/${{ github.sha }}/checks\", \"short\": false }]}]}' |
0 commit comments