Skip to content

Switch to GitHub Actions 🚀 #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2b4dc91
First attempt at using GitHub actions
niik Nov 5, 2020
8dab294
Skip 32bit linux
niik Nov 5, 2020
43f6a3f
Use env var from actions
niik Nov 5, 2020
ca36af5
wip
niik Nov 5, 2020
30aceb5
typo
niik Nov 26, 2020
46b03e7
Finish that thought I had about using jq
niik Nov 26, 2020
ba7f919
Remove appveyor and travis build configs
niik Nov 26, 2020
ac79eb7
Forgot this
niik Nov 26, 2020
c067745
Also trigger on actions branch
dennisameling Nov 27, 2020
f95d0be
Does this trigger CI?
dennisameling Nov 27, 2020
1db9420
Does it trigger now?
dennisameling Nov 27, 2020
0b01b96
Fix CS + try to fix shellcheck
dennisameling Nov 27, 2020
7217ae5
Fix LFS checksum on Linux
dennisameling Nov 27, 2020
cc02d37
Show OS arch in GH Actions log
dennisameling Nov 27, 2020
9718ec5
Try to get things working on Ubuntu, improve errors
dennisameling Nov 27, 2020
e1442c8
Fix Ubuntu + Windows builds (hopefully)
dennisameling Nov 27, 2020
316d3a8
Fix Ubuntu build
dennisameling Nov 27, 2020
feba6ec
Fix bugs in ubuntu + Windows build scripts
dennisameling Nov 27, 2020
50a99b1
Fix several bugs
dennisameling Nov 27, 2020
4e488fc
Add TARGET_ARCH to Windows CI
dennisameling Nov 27, 2020
0f7c678
Add release job
dennisameling Nov 27, 2020
6dbeba9
Fix prettier
dennisameling Nov 27, 2020
44689b5
Create release script
dennisameling Nov 27, 2020
1ac8e69
Fix prettier
dennisameling Nov 27, 2020
1886908
Apply suggestions from code review
dennisameling Nov 27, 2020
ca798ed
Try bumping OS versions
dennisameling Nov 27, 2020
3b81c25
Rework release notes script 🚀
dennisameling Dec 23, 2020
bf616be
Fix prettier ✨
dennisameling Dec 23, 2020
5125f16
Fix tag recognition + artifacts dir
dennisameling Dec 23, 2020
86dcf32
Fix tag name recognition
dennisameling Dec 23, 2020
6551b7a
Change owner to desktop
dennisameling Dec 23, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: CI

on:
push:
branches:
- master
tags:
- v*
pull_request:

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
run: |
sudo apt-get install shellcheck
shopt -s globstar; shellcheck script/**/*.sh

build:
name: ${{ matrix.friendlyName }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-11.0, windows-2019, ubuntu-20.04]
arch: [32, 64]
include:
- os: macos-11.0
friendlyName: macOS
targetPlatform: macOS
- os: windows-2019
friendlyName: Windows
targetPlatform: win32
- os: ubuntu-20.04
friendlyName: Linux
targetPlatform: ubuntu
exclude:
- os: macos-11.0
arch: 32
- os: ubuntu-20.04
arch: 32
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
# Needed for script/package.sh to work
fetch-depth: 0
- name: Install dependencies
run: npm install
- name: Check formatting
run: npm run prettier
- name: Build tools
run: npm run check
- name: Install extra dependencies for building Git on Ubuntu
if: matrix.targetPlatform == 'ubuntu'
run: sudo apt-get install libcurl4-openssl-dev libexpat1-dev gettext
- name: Build
shell: bash
run: script/build.sh
env:
TARGET_PLATFORM: ${{ matrix.targetPlatform }}
TARGET_ARCH: ${{ matrix.arch }}
- name: Package
shell: bash
run: script/package.sh
env:
TARGET_PLATFORM: ${{ matrix.targetPlatform }}
TARGET_ARCH: ${{ matrix.arch }}
- name: Upload output artifacts
uses: actions/upload-artifact@v2
with:
name:
dugite-native-${{ matrix.targetPlatform }}-${{ matrix.arch }}-output
path: ./output
retention-days: 5

release:
name: Create GitHub release
needs: [build, shellcheck]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: './artifacts'

- name: Display structure of downloaded files
run: ls -R
working-directory: './artifacts'

- name: Get tag name without prefix
run: |
DUGITE_TAG=${GITHUB_REF/refs\/tags\//}
echo "DUGITE_TAG=${DUGITE_TAG}" >> $GITHUB_ENV
tagNameWithoutPrefix="${DUGITE_TAG:1}"
echo "DUGITE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV

- name: Generate release notes
run: |
npm ci
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.DUGITE_TAG }}" "${{ secrets.GITHUB_TOKEN }}"
RELEASE_NOTES_FILE=script/release_notes.txt
if [[ ! -f "$RELEASE_NOTES_FILE" ]]; then
echo "$RELEASE_NOTES_FILE does not exist. Something might have gone wrong while generating the release notes."
exit 1
fi
echo 'DUGITE_RELEASE_NOTES<<EOF' >> $GITHUB_ENV
cat ${RELEASE_NOTES_FILE} >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Git ${{ env.DUGITE_TAG_WITHOUT_PREFIX }}
body: ${{ env.DUGITE_RELEASE_NOTES }}
draft: true
prerelease: false

- name: Upload release assets
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Workaround since actions/upload-release-asset doesn't support wildcard paths
script: |
const script = require(`${process.env.GITHUB_WORKSPACE}/script/create-release.js`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a release assets script by taking inspiration from actions/upload-release-asset#47 (comment) 🤓

const artifactsDir = `${process.env.GITHUB_WORKSPACE}/artifacts`;
const releaseId = '${{ steps.create_release.outputs.id }}';
console.log(script({github, context, artifactsDir, releaseId}));
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

28 changes: 0 additions & 28 deletions appveyor.yml

This file was deleted.

89 changes: 89 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading