From 590193f388c613b4f7faefbcbc55f44979e40297 Mon Sep 17 00:00:00 2001 From: Kentaro IMAJO <173752+imos@users.noreply.github.com> Date: Thu, 16 Jul 2020 18:22:53 +0900 Subject: [PATCH] Enable GitHub actions for submission (#18) --- .github/workflows/submit.yml | 23 +++++++++++++++++++++++ .gitignore | 1 + script/create-submission.sh | 9 +++++++-- submission/.github/rust.yml | 20 ++++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/submit.yml create mode 100644 submission/.github/rust.yml diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml new file mode 100644 index 0000000..51ed4ef --- /dev/null +++ b/.github/workflows/submit.yml @@ -0,0 +1,23 @@ +name: Submit + +on: + push: + tags: + - '*' + +env: + CARGO_TERM_COLOR: always + +jobs: + submit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Test + env: + UNAGI_GITHUB_TOKEN: ${{ secrets.UNAGI_GITHUB_TOKEN }} + run: | + git config --global user.email "5896564+ninetan@users.noreply.github.com" + git config --global user.name "ninetan" + bash script/create-submission.sh diff --git a/.gitignore b/.gitignore index 555a181..1a1014a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ # Files for builds. /build /.cache +/vendor diff --git a/script/create-submission.sh b/script/create-submission.sh index 1749c69..dfc4271 100644 --- a/script/create-submission.sh +++ b/script/create-submission.sh @@ -8,8 +8,13 @@ cd "$(dirname "${BASH_SOURCE}")/.." if [ -d build/submission ]; then rm -rf build/submission fi -git clone -b submission --single-branch --depth=1 \ - git@github.com:imos/icfpc2020-submission.git build/submission +if [ "${UNAGI_GITHUB_TOKEN:-}" != '' ]; then + REPOSITORY_URI="https://$UNAGI_GITHUB_TOKEN@github.com/imos/icfpc2020-submission.git" +else + REPOSITORY_URI=git@github.com:imos/icfpc2020-submission.git +fi +git clone -b submission --single-branch --depth=1 "${REPOSITORY_URI}" build/submission + DATETIME="$(TZ=Asia/Tokyo date +%Y%m%d-%H%M%S)" COMMIT_ID="$(git rev-parse --short HEAD)" COMMIT_MSG="$(git log -n 1)" diff --git a/submission/.github/rust.yml b/submission/.github/rust.yml new file mode 100644 index 0000000..adf49ee --- /dev/null +++ b/submission/.github/rust.yml @@ -0,0 +1,20 @@ +name: Rust + +on: + push: + branches: [ submission ] + pull_request: + branches: [ submission ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: cd app && cargo build --release --offline + - name: Run tests + run: cd app && cargo test --verbose