浏览代码

Move triagebot over to GitHub actions

Mark Rousskov 5 年之前
父节点
当前提交
004273153c
共有 7 个文件被更改,包括 41 次插入53 次删除
  1. 40 0
      .github/workflows/ci.yml
  2. 0 15
      .travis.yml
  3. 1 3
      Dockerfile
  4. 0 18
      ci/check-nightly-version.sh
  5. 0 9
      ci/publish-docker.sh
  6. 0 7
      ci/run.sh
  7. 0 1
      rust-toolchain

+ 40 - 0
.github/workflows/ci.yml

@@ -0,0 +1,40 @@
+name: CI
+on:
+  push: {}
+  pull_request: {}
+  schedule:
+    - cron: "0 12 * * 1" # Every Monday at 12:00 UTC
+
+env:
+  AWS_ACCESS_KEY_ID: AKIA46X5W6CZEAQSMRH7
+
+jobs:
+  ci:
+    name: CI
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout the source code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 1
+
+      - name: Install Rust
+        run: rustup update stable && rustup default stable
+
+      - name: Run the test suite
+        run: cargo test
+
+      - name: Build the Docker container
+        run: docker build -t triagebot .
+
+      - name: Deploy to production
+        uses: rust-lang/simpleinfra/github-actions/upload-docker-image@master
+        with:
+          image: triagebot
+          repository: rust-triagebot
+          region: us-west-1
+          redeploy_ecs_cluster: rust-ecs-prod
+          redeploy_ecs_service: triagebot
+          aws_access_key_id: "${{ env.AWS_ACCESS_KEY_ID }}"
+          aws_secret_access_key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
+        if: github.ref == 'refs/heads/master'

+ 0 - 15
.travis.yml

@@ -1,15 +0,0 @@
-language: rust
-rust: nightly-2019-10-11
-cache:
-  - cargo
-
-script: ci/run.sh
-
-# Publish the Docker image to the infra AWS registry
-before_deploy:
-  - pip install --user awscli
-deploy:
-  provider: script
-  script: sh ci/publish-docker.sh
-  on:
-    branch: master

+ 1 - 3
Dockerfile

@@ -14,11 +14,9 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
     pkg-config \
     libssl-dev
 
-# Install the currently pinned toolchain with rustup
-COPY rust-toolchain /tmp/rust-toolchain
 RUN curl https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init >/tmp/rustup-init && \
     chmod +x /tmp/rustup-init && \
-    /tmp/rustup-init -y --no-modify-path --default-toolchain $(cat /tmp/rust-toolchain)
+    /tmp/rustup-init -y --no-modify-path --default-toolchain stable
 ENV PATH=/root/.cargo/bin:$PATH
 
 # Build the dependencies in a separate step to avoid rebuilding all of them

+ 0 - 18
ci/check-nightly-version.sh

@@ -1,18 +0,0 @@
-#!/bin/bash
-set -euo pipefail
-IFS=$'\n\t'
-
-# Extract the nightly version from all the places we declared it in
-rust_toolchain="$(cat rust-toolchain)"
-travis_yml="$(cat .travis.yml | grep '^rust: ' | head -n 1 | sed -E 's/^rust: (nightly-[0-9]{4}-[0-9]{2}-[0-9]{2})$/\1/')"
-
-# Ensure all the configuration files points to the same nightly
-check() {
-    if [[ "$2" != "${rust_toolchain}" ]]; then
-        echo "error: the nightly version in $1 is different than the one in rust-toolchain!" 1>&2
-        exit 1
-    fi
-}
-check .travis.yml "${travis_yml}"
-
-echo "all the configuration files points to the same nightly!"

+ 0 - 9
ci/publish-docker.sh

@@ -1,9 +0,0 @@
-#!/bin/bash
-set -e
-
-ECR_IMAGE="890664054962.dkr.ecr.us-west-1.amazonaws.com/rust-triagebot:latest"
-
-$(aws ecr get-login --no-include-email --region us-west-1)
-
-docker tag rust-triagebot:latest "${ECR_IMAGE}"
-docker push "${ECR_IMAGE}"

+ 0 - 7
ci/run.sh

@@ -1,7 +0,0 @@
-#!/bin/bash
-set -euo pipefail
-IFS=$'\n\t'
-
-ci/check-nightly-version.sh
-cargo test
-docker build -t rust-triagebot .

+ 0 - 1
rust-toolchain

@@ -1 +0,0 @@
-nightly-2019-10-11